Remove unused myKey from TwoPartyDealFlow (#1436)

This commit is contained in:
Ross Nicoll 2017-09-06 15:00:34 +01:00 committed by GitHub
parent b2051952d2
commit 6fa20e33da
6 changed files with 5 additions and 19 deletions

View File

@ -50,8 +50,6 @@ object TwoPartyDealFlow {
abstract val payload: Any
abstract val notaryNode: NodeInfo
abstract val otherParty: Party
// TODO: This is never read from, and should be removed
abstract val myKey: PublicKey
@Suspendable override fun call(): SignedTransaction {
progressTracker.currentStep = GENERATING_ID
@ -169,7 +167,6 @@ object TwoPartyDealFlow {
*/
open class Instigator(override val otherParty: Party,
override val payload: AutoOffer,
override val myKey: PublicKey,
override val progressTracker: ProgressTracker = Primary.tracker()) : Primary() {
override val notaryNode: NodeInfo get() =
serviceHub.networkMapCache.notaryNodes.filter { it.notaryIdentity == payload.notary }.single()

View File

@ -52,11 +52,9 @@ object AutoOfferFlow {
// need to pick which ever party is not us
val otherParty = notUs(dealToBeOffered.participants).map { serviceHub.identityService.partyFromAnonymous(it) }.requireNoNulls().single()
progressTracker.currentStep = DEALING
val myKey = serviceHub.legalIdentityKey
val instigator = Instigator(
otherParty,
AutoOffer(notary, dealToBeOffered),
myKey,
progressTracker.getChildProgressTracker(DEALING)!!
)
val stx = subFlow(instigator)

View File

@ -103,17 +103,12 @@ object FixingFlow {
class Floater(override val otherParty: Party,
override val payload: FixingSession,
override val progressTracker: ProgressTracker = TwoPartyDealFlow.Primary.tracker()) : TwoPartyDealFlow.Primary() {
@Suppress("UNCHECKED_CAST")
internal val dealToFix: StateAndRef<FixableDealState> by transient {
val state = serviceHub.loadState(payload.ref) as TransactionState<FixableDealState>
StateAndRef(state, payload.ref)
}
override val myKey: PublicKey get() {
return serviceHub.keyManagementService.filterMyKeys(dealToFix.state.data.participants.map(AbstractParty::owningKey)).single()
}
override val notaryNode: NodeInfo get() {
return serviceHub.networkMapCache.notaryNodes.single { it.notaryIdentity == dealToFix.state.notary }
}

View File

@ -136,10 +136,9 @@ class IRSSimulation(networkSendManuallyPumped: Boolean, runAsync: Boolean, laten
@InitiatingFlow
class StartDealFlow(val otherParty: Party,
val payload: AutoOffer,
val myKey: PublicKey) : FlowLogic<SignedTransaction>() {
val payload: AutoOffer) : FlowLogic<SignedTransaction>() {
@Suspendable
override fun call(): SignedTransaction = subFlow(Instigator(otherParty, payload, myKey))
override fun call(): SignedTransaction = subFlow(Instigator(otherParty, payload))
}
@InitiatedBy(StartDealFlow::class)
@ -157,8 +156,7 @@ class IRSSimulation(networkSendManuallyPumped: Boolean, runAsync: Boolean, laten
val instigator = StartDealFlow(
node2.info.legalIdentity,
AutoOffer(notary.info.notaryIdentity, irs),
node1.services.legalIdentityKey)
AutoOffer(notary.info.notaryIdentity, irs))
val instigatorTxFuture = node1.services.startFlow(instigator).resultFuture
return allOf(instigatorTxFuture.toCompletableFuture(), acceptorTxFuture).thenCompose { instigatorTxFuture.toCompletableFuture() }

View File

@ -40,8 +40,7 @@ object IRSTradeFlow {
return subFlow(TwoPartyDealFlow.Instigator(
otherParty,
TwoPartyDealFlow.AutoOffer(notary, offer),
serviceHub.legalIdentityKey))
TwoPartyDealFlow.AutoOffer(notary, offer)))
}
}

View File

@ -291,8 +291,7 @@ object SimmFlow {
val seller = TwoPartyDealFlow.Instigator(
replyToParty,
TwoPartyDealFlow.AutoOffer(offer.notary, offer.dealBeingOffered),
serviceHub.legalIdentityKey)
TwoPartyDealFlow.AutoOffer(offer.notary, offer.dealBeingOffered))
logger.info("Starting two party deal initiator with: ${replyToParty.name}")
return subFlow(seller)
}