net.corda.core.CORDARUNTIMEEException:CollectSignaturesFlow的发起人必须准确地传入事务签名所需的会话
我试图学习corda教程,但我不明白我错在哪里…net.corda.core.CORDARUNTIMEEException:CollectSignaturesFlow的发起人必须准确地传入事务签名所需的会话,corda,Corda,我试图学习corda教程,但我不明白我错在哪里… 单元测试已成功运行,但当我尝试通过api发布新IOU时,会引发异常。 这是我借条的流程代码。 标题中有例外,请提前感谢 //get notary reference final Party notary = getServiceHub().getNetworkMapCache().getNotaryIdentities().get(0); //builder final Trans
单元测试已成功运行,但当我尝试通过api发布新IOU时,会引发异常。
这是我借条的流程代码。 标题中有例外,请提前感谢
//get notary reference
final Party notary = getServiceHub().getNetworkMapCache().getNotaryIdentities().get(0);
//builder
final TransactionBuilder builder = new TransactionBuilder(notary);
final List<PublicKey> partiesKey = this.state.getParticipants()
.stream().map(AbstractParty::getOwningKey)
.collect(Collectors.toList());
//create new issue command
final Command<IOUContract.Commands.Issue> cmd = new Command<>(
new IOUContract.Commands.Issue(), partiesKey
);
//create a transaction state
TransactionState<IOUState> txState = new TransactionState<>(this.state,
IOUContract.IOU_CONTRACT_ID, notary);
//add to builder command and state
builder.withItems(cmd, txState);
//verify sign it
builder.verify(getServiceHub());
// Sign the transaction.
final Party me = getOurIdentity();
final SignedTransaction ptx = getServiceHub().signInitialTransaction(builder, me.getOwningKey());
List<Party> otherParties = this.state.getParticipants().stream()
.filter(x -> x.getOwningKey() != me.getOwningKey())
.map(el -> (Party)el)
.collect(Collectors.toList());
//open flow session with other parties
List<FlowSession> sessions = otherParties.stream()
.map(el -> initiateFlow(el))
.collect(Collectors.toList());
SignedTransaction fullSign = subFlow(
new CollectSignaturesFlow(
ptx,
sessions,
ImmutableList.of(me.getOwningKey()),
CollectSignaturesFlow.Companion.tracker()
)
);
return subFlow(new FinalityFlow(fullSign, sessions));
它工作正常,为什么?有什么区别吗?我认为阿德尔是对的,你把错误的一方传递给了收集流 我会仔细检查该列表的内容,以确保运行流的节点不在该列表中 只要做一个简单的检查或类似的事情就可以了:
//Collect all of the required signatures from other Players / Corda nodes using the CollectSignaturesFlow
for (int i = 0; i < input.getPlayers().length; i++) {
Party p = input.getPlayers()[i];
if (p.equals(me)) {
continue;
}
FlowSession session = initiateFlow(p);
new IdentitySyncFlow.Send(session, partStx.getTx());
sessionList.add(session);
}
//使用CollectSignaturesFlow从其他玩家/Corda节点收集所有必需的签名
for(int i=0;i
我认为阿德尔是对的,你把错误的一方传递到了收集流
我会仔细检查该列表的内容,以确保运行流的节点不在该列表中
只要做一个简单的检查或类似的事情就可以了:
//Collect all of the required signatures from other Players / Corda nodes using the CollectSignaturesFlow
for (int i = 0; i < input.getPlayers().length; i++) {
Party p = input.getPlayers()[i];
if (p.equals(me)) {
continue;
}
FlowSession session = initiateFlow(p);
new IdentitySyncFlow.Send(session, partStx.getTx());
sessionList.add(session);
}
//使用CollectSignaturesFlow从其他玩家/Corda节点收集所有必需的签名
for(int i=0;i
您确定没有错误地向自己发出借据吗?在这种情况下,贷方和借方是相同的,其他方
将为空,CollectionsFlow
将抛出错误。您可能在API中将借款人和贷款人作为相同的价值传递。不,贷款人和借款人不是同一方。。。在otherParties变量中,我排除“我”并接受交易中的所有其他方。甲方要求乙方提供借条。在代码上设置断点,并检查借款人
和贷款人
的值。您可以使用启用远程调试。您确定没有错误地尝试向自己发出IOU吗?在这种情况下,贷方和借方是相同的,其他方
将为空,CollectionsFlow
将抛出错误。您可能在API中将借款人和贷款人作为相同的价值传递。不,贷款人和借款人不是同一方。。。在otherParties变量中,我排除“我”并接受交易中的所有其他方。甲方要求乙方提供借条。在代码上设置断点,并检查借款人
和贷款人
的值。您可以使用启用远程调试。
//Collect all of the required signatures from other Players / Corda nodes using the CollectSignaturesFlow
for (int i = 0; i < input.getPlayers().length; i++) {
Party p = input.getPlayers()[i];
if (p.equals(me)) {
continue;
}
FlowSession session = initiateFlow(p);
new IdentitySyncFlow.Send(session, partStx.getTx());
sessionList.add(session);
}