ENT-9927 Ledger Recovery tweaks. (#7407)

This commit is contained in:
Jose Coll 2023-07-03 10:02:34 +01:00 committed by GitHub
parent 49d5b6a4bf
commit 97d8549d4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,11 +60,7 @@ open class ReceiveTransactionFlow constructor(private val otherSideSession: Flow
}
val payload = otherSideSession.receive<Any>().unwrap { it }
val stx =
if (payload is SignedTransactionWithDistributionList) {
(serviceHub as ServiceHubCoreInternal).recordReceiverTransactionRecoveryMetadata(payload.stx.id, otherSideSession.counterparty.name, ourIdentity.name, statesToRecord, payload.distributionList)
payload.stx
} else payload as SignedTransaction
val stx = resolvePayload(payload)
stx.pushToLoggingContext()
logger.info("Received transaction acknowledgement request from party ${otherSideSession.counterparty}.")
checkParameterHash(stx.networkParametersHash)
@ -87,6 +83,15 @@ open class ReceiveTransactionFlow constructor(private val otherSideSession: Flow
return stx
}
open fun resolvePayload(payload: Any): SignedTransaction {
return if (payload is SignedTransactionWithDistributionList) {
if (checkSufficientSignatures || deferredAck) {
(serviceHub as ServiceHubCoreInternal).recordReceiverTransactionRecoveryMetadata(payload.stx.id, otherSideSession.counterparty.name, ourIdentity.name, statesToRecord, payload.distributionList)
payload.stx
} else payload.stx
} else payload as SignedTransaction
}
/**
* Hook to perform extra checks on the received transaction just before it's recorded. The transaction has already
* been resolved and verified at this point.