even moar logs and fixes

This commit is contained in:
djmil 2023-11-28 22:00:55 +01:00
parent bdd02f721f
commit 7c96bc3fc5

View File

@ -22,8 +22,8 @@ public class CommitTrxResponder implements ResponderFlow {
private final static Logger log = LoggerFactory.getLogger(CommitTrxResponder.class); private final static Logger log = LoggerFactory.getLogger(CommitTrxResponder.class);
@CordaInject // @CordaInject
public MemberLookup memberLookup; // public MemberLookup memberLookup;
@CordaInject @CordaInject
public UtxoLedgerService utxoLedgerService; public UtxoLedgerService utxoLedgerService;
@ -31,9 +31,11 @@ public class CommitTrxResponder implements ResponderFlow {
@Suspendable @Suspendable
@Override @Override
public void call(FlowSession session) { public void call(FlowSession session) {
log.info("----> CommitTrxResponder: Session "+session);
try { try {
UtxoTransactionValidator txValidator = trxToValidate -> { UtxoTransactionValidator txValidator = trxToValidate -> {
checkParticipants(session, trxToValidate); log.info("----> Checking participants... ");
//checkParticipants(session, trxToValidate);
/* /*
* Other checks / actions ? * Other checks / actions ?
@ -53,21 +55,21 @@ public class CommitTrxResponder implements ResponderFlow {
} }
} }
@Suspendable // @Suspendable
void checkParticipants(FlowSession session, UtxoLedgerTransaction gameStateUtxo) { // void checkParticipants(FlowSession session, UtxoLedgerTransaction gameStateUtxo) {
final GameInfo info = new GameInfo(gameStateUtxo); // final GameInfo info = new GameInfo(gameStateUtxo);
final var conterpartyName = session.getCounterparty(); // final var conterpartyName = session.getCounterparty();
if (info.issuer.compareTo(conterpartyName) != 0) // if (info.issuer.compareTo(conterpartyName) != 0)
throw new CordaRuntimeException("Bad Issuer. Expected: " + conterpartyName + " actual: " + info.issuer); // throw new CordaRuntimeException("Bad Issuer. Expected: " + conterpartyName + " actual: " + info.issuer);
final var myInfo = memberLookup.myInfo(); // final var myInfo = memberLookup.myInfo();
if (VNode.isCordaCherckersCustodian(myInfo)) // if (VNode.isCordaCherckersCustodian(myInfo))
return; // Custodian shall not validate state's counterparty // return; // Custodian shall not validate state's counterparty
final var opponentName = info.state.getOpponentName(myInfo.getName()); // throws NotInvolved // final var opponentName = info.state.getOpponentName(myInfo.getName()); // throws NotInvolved
if (conterpartyName.compareTo(opponentName) != 0) // if (conterpartyName.compareTo(opponentName) != 0)
throw new CordaRuntimeException("Bad Opponent. Expcted: " + conterpartyName + " axtual: " + opponentName); // throw new CordaRuntimeException("Bad Opponent. Expcted: " + conterpartyName + " axtual: " + opponentName);
} // }
// public static class ParticipantException extends Exception { // public static class ParticipantException extends Exception {
// public ParticipantException(String role, MemberX500Name expected, // public ParticipantException(String role, MemberX500Name expected,