From 1ce96448dbafb5de90c32d3844b3d75e6c171145 Mon Sep 17 00:00:00 2001 From: djmil Date: Tue, 28 Nov 2023 22:39:58 +0100 Subject: [PATCH] better sessionlist --- .../java/djmil/cordacheckers/gamestate/CommitTrx.java | 11 ++++++----- .../cordacheckers/gamestate/CommitTrxResponder.java | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/corda/workflows/src/main/java/djmil/cordacheckers/gamestate/CommitTrx.java b/corda/workflows/src/main/java/djmil/cordacheckers/gamestate/CommitTrx.java index 7141c5e..df584db 100644 --- a/corda/workflows/src/main/java/djmil/cordacheckers/gamestate/CommitTrx.java +++ b/corda/workflows/src/main/java/djmil/cordacheckers/gamestate/CommitTrx.java @@ -58,12 +58,13 @@ public class CommitTrx implements SubFlow { * notarises the transaction and persists the transaction to each party's vault. */ - final FlowSession session = flowMessaging.initiateFlow(this.counterpartyName); - List sessionsList = new LinkedList(Arrays.asList(session)); + final FlowSession counterpartySession = flowMessaging.initiateFlow(this.counterpartyName); - if (custodyName != null) { - sessionsList.add(flowMessaging.initiateFlow(custodyName)); - } + List sessionsList = (this.custodyName != null) + ? Arrays.asList(counterpartySession, flowMessaging.initiateFlow(this.custodyName)) + : Arrays.asList(counterpartySession); + + System.out.println("sessionsList size " + sessionsList.size()); final SecureHash trxId = ledgerService .finalize(this.utxTrxCandidate, sessionsList) diff --git a/corda/workflows/src/main/java/djmil/cordacheckers/gamestate/CommitTrxResponder.java b/corda/workflows/src/main/java/djmil/cordacheckers/gamestate/CommitTrxResponder.java index 6e0b276..ab5574d 100644 --- a/corda/workflows/src/main/java/djmil/cordacheckers/gamestate/CommitTrxResponder.java +++ b/corda/workflows/src/main/java/djmil/cordacheckers/gamestate/CommitTrxResponder.java @@ -34,19 +34,19 @@ public class CommitTrxResponder implements ResponderFlow { log.info("----> CommitTrxResponder: Session "+session); try { UtxoTransactionValidator txValidator = trxToValidate -> { - log.info("----> Checking participants... "); + log.info("----> Checking participants... " + trxToValidate); //checkParticipants(session, trxToValidate); /* * Other checks / actions ? */ - log.info("Approval for " + trxToValidate.getId()); + //log.info("Approval for " + trxToValidate.getId()); }; if (utxoLedgerService == null) { log.error("utxoLedgerService is NULL"); - return; + return; } UtxoSignedTransaction finalizedSignedTransaction = this.utxoLedgerService .receiveFinality(session, txValidator)