无法访问的现金状态

问题描述 投票:0回答:1

我遇到现金状况问题。基本上,我有一个节点,该节点自行发行货币,并且无法访问现有状态以用于付款/任何操作。假设这个状态是5美元,如果我再发行10美元,则rpcOps和servicehub getCashBalances都会说我有15美元。但是,任何尝试使用10美元以上的现金流量都会告诉我我的余额不足。

我已经为该节点设置了api端点,甚至可以退出现金,但它会说我退出的人数超出了我的能力。当我用QueryCriteria.VaultQueryCriteria(Vault.StateStatus.UNCONSUMED)查询保管库时,我可以看到状态存在,并且似乎没有任何东西可以将不可访问状态与任何后续可访问状态区分开。

我能在这里俯瞰什么吗?发行者是相同的,并且所有者是散列的,但也应该相同。

使用命令/代码更新:

fun selfIssueTime(@QueryParam(value = "amount") amount: Long,
                  @QueryParam(value = "currency") currency: String): Response {

    // 1. Prepare issue request.
    val issueAmount = Amount(amount.toLong() * 100, Currency.getInstance(currency))
    val notary = rpcOps.notaryIdentities().firstOrNull() ?: throw IllegalStateException("Could not find a notary.")
    val issueRef = OpaqueBytes.of(0)
    val issueRequest = CashIssueFlow.IssueRequest(issueAmount, issueRef, notary)
    val self = myIdentity

    // 2. Start flow and wait for response.
    val (status, message) = try {
        val flowHandle = rpcOps.startFlowDynamic(
                CashIssueFlow::class.java,
                issueRequest
        )

        flowHandle.use { it.returnValue.getOrThrow() }
        CREATED to "$issueAmount issued to $self."
    } catch (e: Exception) {
        BAD_REQUEST to e.message
    }

    // 3. Return the response.
    return Response.status(status).entity(message).build()
}
corda
1个回答
1
投票

我相信这是通过更高版本的Corda金融罐解决的。我们使用currency类开发了更多的CorDapps示例,但没有遇到任何问题。例如:https://github.com/corda/samples-java/blob/master/Tokens/dollartohousetoken/workflows/src/main/java/net/corda/examples/dollartohousetoken/flows/FiatCurrencyIssueFlow.java#L39

此外,随着Corda TokenSDk的发布,Corda上的Currency实际上具有一种获取发行,转移和赎回的新方法。这是通过以下方式完成的:

        /* Create an instance of the fiat currency token */
        TokenType token = FiatCurrency.Companion.getInstance(currency);

        /* Create an instance of IssuedTokenType for the fiat currency */
        IssuedTokenType issuedTokenType = new IssuedTokenType(getOurIdentity(), token);

        /* Create an instance of FungibleToken for the fiat currency to be issued */
        FungibleToken fungibleToken = new FungibleToken(new Amount<>(amount, issuedTokenType), recipient, null);

        /* Issue the required amount of the token to the recipient */
        return subFlow(new IssueTokens(ImmutableList.of(fungibleToken), ImmutableList.of(recipient)));
© www.soinside.com 2019 - 2024. All rights reserved.