即使有效的交易显示了输出,vaultquery也不返回任何状态

时间:2019-03-30 22:52:40

标签: corda

我正在Corda上创建某种货币令牌,并且正在运行有问题的流程。在测试流程时,一切都会按预期进行。使用指定的字段创建了一个CurrencyState(实现FungibleAsset)。但是,对CurrenyState进行保管库查询时,它始终不返回任何内容。这令人困惑,因为我有相似的流程以相同的方式创建所有工作状态的不同状态。

我尝试运行NodeDriver,然后启动流程并通过端点上的邮递员查询保管库。那里同样的问题。创建和查询其他状态有效,但查询可替代状态无效。顺便说一下,其他工作状态是LinearStates。可能与实现的接口有关吗?

我还尝试使用可替代的资产条件和各种不同的选项来查询Vault。

 public void flowRecordsTheIssuedCurrencyInBothPartiesVaults() throws Exception {
    Amount<Currency> testAmount20Rappen = new Amount<Currency>(20,Currency.getInstance("CHF"));
    CurrencyIssueFlow.Initiator flow = new CurrencyIssueFlow.Initiator(testAmount20Rappen, Amag.getInfo().getLegalIdentities().get(0));
    CordaFuture<SignedTransaction> future = CurrencyIssuer.startFlow(flow);
    network.runNetwork();
    future.get();

// We check the recorded currency in both vaults.
for (StartedMockNode node : ImmutableList.of(Amag)) {
    node.transaction(() -> {
        QueryCriteria.VaultQueryCriteria criteria = new QueryCriteria.VaultQueryCriteria(Vault.StateStatus.UNCONSUMED);
        Vault.Page<CurrencyState> results = node.getServices().getVaultService().queryBy(CurrencyState.class, criteria);
        assertEquals(1, results.getStates().size());
        CurrencyState recordedCurrency = results.getStates().get(0).getState().getData();
        assertEquals(recordedCurrency.getAmount(), testAmount20Rappen);
        assertEquals(recordedCurrency.getOwner(), Amag.getInfo().getLegalIdentities().get(0));
        assertEquals(recordedCurrency.getIssuer(), CurrencyIssuer.getInfo().getLegalIdentities().get(0));
        return null;
    });
}

}

0 个答案:

没有答案