moar logs

This commit is contained in:
djmil 2023-11-28 23:44:36 +01:00
parent 609341631d
commit 6c54cc679c
3 changed files with 26 additions and 16 deletions

View File

@ -19,7 +19,7 @@ public class GameProposalContract implements net.corda.v5.ledger.utxo.Contract {
requireThat(trx.getCommands().size() == 1, GameCommand.REQUIRE_SINGLE_COMMAND);
final GameCommand command = getSingleCommand(trx, GameCommand.class);
log.info("GameProposalContract.verify() " +command);
log.info("GameProposalContract.verify() " +command.getAction());
switch (command.getAction()) {
case GAME_PROPOSAL_CREATE:
@ -42,7 +42,7 @@ public class GameProposalContract implements net.corda.v5.ledger.utxo.Contract {
throw new GameCommand.ActionException();
}
log.info("GameProposalContract.verify() " +command + " [OK]");
log.info("GameProposalContract.verify() " +command.getAction() + " [OK]");
}
}

View File

@ -19,6 +19,8 @@ public class GameResultContract implements net.corda.v5.ledger.utxo.Contract {
requireThat(trx.getCommands().size() == 1, GameCommand.REQUIRE_SINGLE_COMMAND);
final GameCommand command = getSingleCommand(trx, GameCommand.class);
log.info("GameResultContract.verify() " +command.getAction());
switch (command.getAction()) {
case SURRENDER:
command.validateSurrender(trx);
@ -35,6 +37,8 @@ public class GameResultContract implements net.corda.v5.ledger.utxo.Contract {
default:
throw new GameCommand.ActionException();
}
log.info("GameResultContract.verify() " +command.getAction() + " [OK]");
}
}

View File

@ -53,23 +53,29 @@ public class CommitTrx implements SubFlow<SecureHash> {
public SecureHash call() {
log.info("GameState commit started");
/*
* Calls the Corda provided finalise() function which gather signatures from the counterparty,
* notarises the transaction and persists the transaction to each party's vault.
*/
try {
/*
* Calls the Corda provided finalise() function which gather signatures from the counterparty,
* notarises the transaction and persists the transaction to each party's vault.
*/
List<FlowSession> sessionsList = (this.custodyName != null)
? Arrays.asList(flowMessaging.initiateFlow(this.counterpartyName), flowMessaging.initiateFlow(this.custodyName))
: Arrays.asList(flowMessaging.initiateFlow(this.counterpartyName));
List<FlowSession> sessionsList = (this.custodyName != null)
? Arrays.asList(flowMessaging.initiateFlow(this.counterpartyName), flowMessaging.initiateFlow(this.custodyName))
: Arrays.asList(flowMessaging.initiateFlow(this.counterpartyName));
System.out.println("sessionsList size " + sessionsList.size());
System.out.println("sessionsList size " + sessionsList.size());
final SecureHash trxId = ledgerService
.finalize(this.utxTrxCandidate, sessionsList)
.getTransaction()
.getId();
final SecureHash trxId = ledgerService
.finalize(this.utxTrxCandidate, sessionsList)
.getTransaction()
.getId();
log.info("GameState commit " +trxId);
return trxId;
log.info("GameState commit " +trxId);
return trxId;
} catch (Exception e) {
log.warn("GameState finality failed", e);
throw e;
}
}
}