CORDA-3060: Notary logging improvements

Add more detailed logging to the notary service flow.
This commit is contained in:
Andrius Dagys 2019-09-12 14:20:46 +01:00
parent 16e4650d8d
commit c7cd947c32
3 changed files with 9 additions and 7 deletions

View File

@ -61,7 +61,7 @@ class NotaryFlow {
logger.info("Sending transaction to notary: ${notaryParty.name}.")
progressTracker.currentStep = REQUESTING
val response = notarise(notaryParty)
logger.info("Notary responded.")
logger.info("Notary responded (${notaryParty.name}).")
progressTracker.currentStep = VALIDATING
return validateResponse(response, notaryParty)
}

View File

@ -81,6 +81,7 @@ abstract class NotaryServiceFlow(val otherSideSession: FlowSession, val service:
try {
val transaction = extractParts(requestPayload)
transactionId = transaction.id
logger.info("Received a notarisation request for Tx [$transactionId] from [${otherSideSession.counterparty.name}]")
checkNotary(transaction.notary)
checkParameterHash(transaction.networkParametersHash)
checkInputs(transaction.inputs + transaction.references)
@ -125,6 +126,7 @@ abstract class NotaryServiceFlow(val otherSideSession: FlowSession, val service:
@Suspendable
private fun signTransactionAndSendResponse(txId: SecureHash) {
val signature = service.signTransaction(txId)
logger.info("Transaction [$txId] successfully notarised, sending signature back to [${otherSideSession.counterparty.name}]")
otherSideSession.send(NotarisationResponse(listOf(signature)))
}

View File

@ -181,7 +181,7 @@ class PersistentUniquenessProvider(val clock: Clock, val database: CordaPersiste
val future = openFuture<UniquenessProvider.Result>()
val request = CommitRequest(states, txId, callerIdentity, requestSignature, timeWindow, references, future)
requestQueue.put(request)
log.debug { "Request added to queue. txId: $txId" }
log.debug { "Request added to queue. TxId: $txId" }
return future
}
@ -247,18 +247,18 @@ class PersistentUniquenessProvider(val clock: Clock, val database: CordaPersiste
private fun handleReferenceConflicts(txId: SecureHash, conflictingStates: LinkedHashMap<StateRef, StateConsumptionDetails>) {
if (!previouslyCommitted(txId)) {
val conflictError = NotaryError.Conflict(txId, conflictingStates)
log.info("Failure, input states already committed: ${conflictingStates.keys}. txId: $txId")
log.info("Failure, input states already committed: ${conflictingStates.keys}. TxId: $txId")
throw NotaryInternalException(conflictError)
}
log.info("Transaction $txId already notarised. txId: $txId")
log.info("Transaction $txId already notarised. TxId: $txId")
}
private fun handleConflicts(txId: SecureHash, conflictingStates: LinkedHashMap<StateRef, StateConsumptionDetails>) {
if (isConsumedByTheSameTx(txId.sha256(), conflictingStates)) {
log.info("Transaction $txId already notarised. txId: $txId")
log.info("Transaction $txId already notarised. TxId: $txId")
return
} else {
log.info("Failure, input states already committed: ${conflictingStates.keys}. txId: $txId")
log.info("Failure, input states already committed: ${conflictingStates.keys}. TxId: $txId")
val conflictError = NotaryError.Conflict(txId, conflictingStates)
throw NotaryInternalException(conflictError)
}
@ -277,7 +277,7 @@ class PersistentUniquenessProvider(val clock: Clock, val database: CordaPersiste
}
val session = currentDBSession()
session.persist(CommittedTransaction(txId.toString()))
log.info("Successfully committed all input states: $states. txId: $txId")
log.info("Successfully committed all input states: $states. TxId: $txId")
} else {
throw NotaryInternalException(outsideTimeWindowError)
}