为什么我的流测试即使在某些节点上存在存储也无法检查某些节点中的事务?

时间:2019-03-05 19:56:33

标签: java corda

  

错误:java.lang.AssertionError:预期:net.corda.core.transactions.SignedTransaction,但之前是:net.corda.core.transactions.SignedTransaction       预期的:net.corda.core.transactions.SignedTransaction       实际:net.corda.core.transactions.SignedTransaction

据我所知,预期交易和实际交易都是相同的,但仍然会引发错误。它正在通过其他测试,但是突然失败,并且没有任何令人满意的信息来调试。 以下是我测试中的代码:

@Test
    public void flowRecordsATransactionInBothPartiesTransactionStorages() throws Exception {
        SignedTransaction signedTx = createPlacementCompleteTxn();

        // We check the recorded transaction in both vaults.
        for (StartedMockNode node : ImmutableList.of(participantsNodes.get(0), participantsNodes.get(1), participantsNodes.get(3))) {
            assertEquals(signedTx, node.getServices().getValidatedTransactions().getTransaction(signedTx.getId()));
        }

1 个答案:

答案 0 :(得分:0)

这对我在Corda 4上工作正常。例如,以下测试通过:

@Test
public void recordedTransactionIsCorrect() throws Exception {
    ExampleFlow.Initiator flow = new ExampleFlow.Initiator(1, b.getInfo().getLegalIdentities().get(0));
    CordaFuture<SignedTransaction> future = a.startFlow(flow);
    network.runNetwork();
    SignedTransaction signedTx = future.get();

    // We check the recorded transaction in both vaults.
    for (StartedMockNode node : ImmutableList.of(a, b)) {
        SignedTransaction recordedTx = node.getServices().getValidatedTransactions().getTransaction(signedTx.getId());
        assertEquals(recordedTx, signedTx);
    }
}