diff --git a/src/main/kotlin/protocols/RatesFixProtocol.kt b/src/main/kotlin/protocols/RatesFixProtocol.kt index b19220e38b..270be3e80c 100644 --- a/src/main/kotlin/protocols/RatesFixProtocol.kt +++ b/src/main/kotlin/protocols/RatesFixProtocol.kt @@ -24,16 +24,17 @@ open class RatesFixProtocol(protected val tx: TransactionBuilder, private val oracle: NodeInfo, private val fixOf: FixOf, private val expectedRate: BigDecimal, - private val rateTolerance: BigDecimal) : ProtocolLogic() { + private val rateTolerance: BigDecimal, + override val progressTracker: ProgressTracker = RatesFixProtocol.tracker(fixOf.name)) : ProtocolLogic() { companion object { val TOPIC = "platform.rates.interest.fix" class QUERYING(val name: String) : ProgressTracker.Step("Querying oracle for $name interest rate") object WORKING : ProgressTracker.Step("Working with data returned by oracle") - object SIGNING : ProgressTracker.Step("Requesting transaction signature from interest rate oracle") - } + object SIGNING : ProgressTracker.Step("Requesting confirmation signature from interest rate oracle") - override val progressTracker = ProgressTracker(QUERYING(fixOf.name), WORKING, SIGNING) + fun tracker(fixName: String) = ProgressTracker(QUERYING(fixName), WORKING, SIGNING) + } class FixOutOfRange(val byAmount: BigDecimal) : Exception() diff --git a/src/main/kotlin/protocols/TwoPartyDealProtocol.kt b/src/main/kotlin/protocols/TwoPartyDealProtocol.kt index dfa826263f..79863aa8f6 100644 --- a/src/main/kotlin/protocols/TwoPartyDealProtocol.kt +++ b/src/main/kotlin/protocols/TwoPartyDealProtocol.kt @@ -59,8 +59,8 @@ object TwoPartyDealProtocol { override val progressTracker: ProgressTracker = Primary.tracker()) : ProtocolLogic() { companion object { - object AWAITING_PROPOSAL : ProgressTracker.Step("Awaiting transaction proposal from other") - object VERIFYING : ProgressTracker.Step("Verifying transaction proposal from other") + object AWAITING_PROPOSAL : ProgressTracker.Step("Handshaking and awaiting transaction proposal") + object VERIFYING : ProgressTracker.Step("Verifying proposed transaction") object SIGNING : ProgressTracker.Step("Signing transaction") object TIMESTAMPING : ProgressTracker.Step("Timestamping transaction") object SENDING_SIGS : ProgressTracker.Step("Sending transaction signatures to other party") @@ -158,7 +158,6 @@ object TwoPartyDealProtocol { @Suspendable private fun timestamp(partialTX: SignedTransaction): DigitalSignature.LegallyIdentifiable { - progressTracker.childrenFor[TIMESTAMPING] = TimestampingProtocol.tracker() progressTracker.currentStep = TIMESTAMPING return subProtocol(TimestampingProtocol(timestampingAuthority, partialTX.txBits, progressTracker.childrenFor[TIMESTAMPING]!!)) } @@ -333,7 +332,14 @@ object TwoPartyDealProtocol { timestampingAuthority: Party, val dealToFix: StateAndRef, sessionID: Long, - override val progressTracker: ProgressTracker = Secondary.tracker()) : Secondary(otherSide, timestampingAuthority, sessionID) { + val replacementProgressTracker: ProgressTracker? = null) : Secondary(otherSide, timestampingAuthority, sessionID) { + private val ratesFixTracker = RatesFixProtocol.tracker(dealToFix.state.nextFixingOf()!!.name) + + override val progressTracker: ProgressTracker = replacementProgressTracker ?: createTracker() + + fun createTracker(): ProgressTracker = Secondary.tracker().apply { + childrenFor[SIGNING] = ratesFixTracker + } @Suspendable override fun validateHandshake(handshake: Handshake): Handshake { @@ -369,7 +375,6 @@ object TwoPartyDealProtocol { val ptx = TransactionBuilder() val addFixing = object : RatesFixProtocol(ptx, serviceHub.networkMapCache.ratesOracleNodes[0], fixOf, BigDecimal.ZERO, BigDecimal.ONE) { - @Suspendable override fun beforeSigning(fix: Fix) { newDeal.generateFix(ptx, oldRef, fix) @@ -378,7 +383,6 @@ object TwoPartyDealProtocol { // to have one. ptx.setTime(serviceHub.clock.instant(), timestampingAuthority, 30.seconds) } - } subProtocol(addFixing)