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