Corda Cash.Commands.Issue()出现意外行为

Corda Cash.Commands.Issue()出现意外行为,corda,Corda,我需要一些帮助来理解我在Cash.Commands.Issue中注意到的一些东西。在一些测试中,我发现通过使用Cash.Commands.Issue,发行人可以在未经其同意的情况下从拥有该Cash.State的一方手中拿走现金(使用Cash.State) 我正在用Java重写CashTests.kt以供练习: …当我遇到这种行为时。测试:extended issue examples演示了使用发行命令,发行人可以使用现有现金。声明并创建一个金额更大的新现金。只要唯一改变的是增加的数量,这是有意

我需要一些帮助来理解我在Cash.Commands.Issue中注意到的一些东西。在一些测试中,我发现通过使用Cash.Commands.Issue,发行人可以在未经其同意的情况下从拥有该Cash.State的一方手中拿走现金(使用Cash.State)

我正在用Java重写CashTests.kt以供练习:

…当我遇到这种行为时。测试:
extended issue examples
演示了使用发行命令,发行人可以使用现有现金。声明并创建一个金额更大的新现金。只要唯一改变的是增加的数量,这是有意义的

为了好玩,我试着换了新现金的主人。州政府期望它失败,但它没有。它创建新的现金。在使用原始现金时,与新所有者和更高金额一起声明。声明使原始所有者一无所有。这是正确的吗?我对这笔交易的理解是现金的发行人。国家可以在未经其许可的情况下从拥有方手中拿走现金

Amount<Currency> amountCurrency = DOLLARS(1000);

Amount<Issued<Currency>> amountIssuedCurrency = new Amount<Issued<Currency>> (
     amountCurrency.getQuantity(),
     new Issued<Currency>(megaCorp.ref("123".getBytes()), amountCurrency.getToken())
);

Cash.State initialCashState = new Cash.State(amountIssuedCurrency, alice.getParty());

Cash.State doubleInitialCashStateAndNewOwner = 
    initialCashState.copy(initialCashState.getAmount().times(2), charlie.getParty());

NodeTestUtils.ledger(megaCorpServices, dummyNotary.getParty(), l -> {

    l.transaction("megaCorp issues alice money", tx -> {
        tx.attachment(Cash.PROGRAM_ID);
        tx.output(Cash.PROGRAM_ID, "alice money", initialCashState);
        tx.command(megaCorp.getPublicKey(), new Cash.Commands.Issue());
        return tx.verifies();
    });

    // Here we will extend "alice money" to double the amount but switch the 
    // owner to charlie  (this is the part that confuses me)
    l.transaction("megaCorp extends issue and changes owner", tx -> {
        tx.attachment(Cash.PROGRAM_ID);
        tx.input("alice money");
        tx.output(Cash.PROGRAM_ID, "charlie money", doubleInitialCashStateAndNewOwner);
        tx.command(megaCorp.getPublicKey(), new Cash.Commands.Issue());
        return tx.verifies();
    });

    l.verifies();
    return Unit.INSTANCE;
});
金额金额币种=美元(1000);
金额金额币种=新金额(
amountCurrency.getQuantity(),
新发布的(megaCorp.ref(“123.getBytes())、amountCurrency.getToken())
);
Cash.State initialCashState=new Cash.State(amountsuseedcurrency,alice.getParty());
Cash.State doubleInitialCashStateAndNewOwner=
copy(initialCashState.getAmount().times(2),charlie.getParty());
NodeTestUtils.ledger(MegaCarbitServices,dummyNotary.getParty(),l->{
l、 交易(“megaCorp发行alice money”,德克萨斯州->{
附件(现金、项目编号);
tx.output(Cash.PROGRAM_ID,“alice money”,initialCashState);
tx.command(megaCorp.getPublicKey(),new Cash.Commands.Issue());
返回tx.verifys();
});
//在这里,我们将扩展“alice money”以使金额翻倍,但切换
//查理的主人(这是让我困惑的部分)
l、 交易(“megaCorp扩展发行和更改所有者”,tx->{
附件(现金、项目编号);
tx.input(“爱丽丝货币”);
tx.output(Cash.PROGRAM_ID,“charlie money”,双首字母cashstate和newowner);
tx.command(megaCorp.getPublicKey(),new Cash.Commands.Issue());
返回tx.verifys();
});
l、 验证();
返回Unit.INSTANCE;
});

我认为财务模块有点过时了。请看一看正在积极开发并应得到支持的项目