尽管已定义步骤,但在进度跟踪器中未找到

时间:2019-12-13 21:42:18

标签: corda

运行流程时出现以下错误:

java.lang.IllegalArgumentException: Step Requesting Stellar to execute the escrow. not found in progress tracker.
    at net.corda.core.utilities.ProgressTracker.setCurrentStep(ProgressTracker.kt:140) ~[corda-core-4.3.jar:?]
    at com.finablr.money.loyalty.wallet.flows.RevokeCustomToken.call(RevokeCustomToken.java:139) ~[wallet-workflows-0.1.jar:?]
    at com.finablr.money.loyalty.wallet.flows.RevokeCustomToken.call(RevokeCustomToken.java:36) ~[wallet-workflows-0.1.jar:?]
    at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:270) ~[corda-node-4.3.jar:?]
    at net.corda.node.services.statemachine.FlowStateMachineImpl.run(FlowStateMachineImpl.kt:46) ~[corda-node-4.3.jar:?]
    at co.paralleluniverse.fibers.Fiber.run1(Fiber.java:1092) ~[quasar-core-0.7.10-jdk8.jar:0.7.10]
    at co.paralleluniverse.fibers.Fiber.exec(Fiber.java:788) ~[quasar-core-0.7.10-jdk8.jar:0.7.10]
    at co.paralleluniverse.fibers.RunnableFiberTask.doExec(RunnableFiberTask.java:100) ~[quasar-core-0.7.10-jdk8.jar:0.7.10]
    at co.paralleluniverse.fibers.RunnableFiberTask.run(RunnableFiberTask.java:91) ~[quasar-core-0.7.10-jdk8.jar:0.7.10]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_222]
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_222]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) ~[?:1.8.0_222]
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[?:1.8.0_222]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_222]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_222]
    at net.corda.node.utilities.AffinityExecutor$ServiceAffinityExecutor$1$thread$1.run(AffinityExecutor.kt:63) ~[corda-node-4.3.jar:?]

即使我在流程中定义了该步骤,

private final Step STELLAR_EXECUTE_ESCROW = new Step("Requesting Stellar to execute the escrow.");

private final ProgressTracker progressTracker = new ProgressTracker(    
    STELLAR_EXECUTE_ESCROW
);

// Inside the call() method.
// Checkpoint workflow to replay from here in case of node failure.
sleep(Duration.ofMillis(1));

// Request Stellar to execute the escrow.
progressTracker.setCurrentStep(STELLAR_EXECUTE_ESCROW);

流测试并没有引发该错误,它只发生在Google云端;不知道检查点流是否是造成这种情况的原因。

1 个答案:

答案 0 :(得分:0)

您是说这个问题是Google云独有的吗?您在本地运行时没有这个问题吗?

我将仔细检查您如何定义progressTracker。

这是我很方便的代码示例中对progresstracker定义的重点内容。

public class YoFlow extends FlowLogic<SignedTransaction> {
    private static final ProgressTracker.Step CREATING = new ProgressTracker.Step("Creating a new Yo!");
    private static final ProgressTracker.Step SIGNING = new ProgressTracker.Step("Signing the Yo!");
    private static final ProgressTracker.Step VERIFYING = new ProgressTracker.Step("Verfiying the Yo!");
    private static final ProgressTracker.Step FINALISING = new ProgressTracker.Step("Sending the Yo!") {
        @Nullable
        @Override
        public ProgressTracker childProgressTracker() {
            return FinalityFlow.tracker();
        }
    };

    ProgressTracker progressTracker = new ProgressTracker(
            CREATING,
            SIGNING,
            VERIFYING,
            FINALISING
    );

    @Nullable
    @Override
    public ProgressTracker getProgressTracker() {
        return progressTracker;
    }

    private final Party target;

    public YoFlow(Party target) {
        this.target = target;
    }

    @Suspendable
    @Override
    public SignedTransaction call() throws FlowException {
        progressTracker.setCurrentStep(CREATING);

作为另一种可能性,请确保您覆盖了进度跟踪器方法,否则,由于模糊的Corda错误,您将无法通过SSH调用流。

请参见https://docs.corda.net/docs/corda-os/4.4/shell.html#limitations

“除非流覆盖进度跟踪器,否则流无法运行”