diff --git a/contracts/src/main/kotlin/com/r3corda/protocols/TwoPartyTradeProtocol.kt b/contracts/src/main/kotlin/com/r3corda/protocols/TwoPartyTradeProtocol.kt index a251957404..a9a16df05d 100644 --- a/contracts/src/main/kotlin/com/r3corda/protocols/TwoPartyTradeProtocol.kt +++ b/contracts/src/main/kotlin/com/r3corda/protocols/TwoPartyTradeProtocol.kt @@ -205,9 +205,6 @@ object TwoPartyTradeProtocol { logger.trace { "Got signatures from seller, verifying ... " } - // TODO: figure out a way to do Notary verification along with other command signatures in SignedTransaction.verify() - verifyCorrectNotary(stx.tx, signatures.notarySig) - val fullySigned = stx + signatures.sellerSig + signatures.notarySig fullySigned.verify() @@ -263,11 +260,6 @@ object TwoPartyTradeProtocol { return ptx.toSignedTransaction(checkSufficientSignatures = false) } - private fun verifyCorrectNotary(wtx: WireTransaction, sig: DigitalSignature.LegallyIdentifiable) { - val notary = serviceHub.loadState(wtx.inputs.first()).notary - check(sig.signer == notary) { "Transaction not signed by the required Notary" } - } - private fun assembleSharedTX(tradeRequest: SellerTradeInfo): Pair> { val ptx = TransactionType.General.Builder() // Add input and output states for the movement of cash, by using the Cash contract to generate the states. diff --git a/core/src/main/kotlin/com/r3corda/protocols/TwoPartyDealProtocol.kt b/core/src/main/kotlin/com/r3corda/protocols/TwoPartyDealProtocol.kt index b091ba8123..506cd87499 100644 --- a/core/src/main/kotlin/com/r3corda/protocols/TwoPartyDealProtocol.kt +++ b/core/src/main/kotlin/com/r3corda/protocols/TwoPartyDealProtocol.kt @@ -224,7 +224,6 @@ object TwoPartyDealProtocol { logger.trace { "Got signatures from other party, verifying ... " } - verifyCorrectNotary(stx.tx, signatures.notarySig) val fullySigned = stx + signatures.sellerSig + signatures.notarySig fullySigned.verify() @@ -269,12 +268,6 @@ object TwoPartyDealProtocol { return ptx.toSignedTransaction(checkSufficientSignatures = false) } - private fun verifyCorrectNotary(wtx: WireTransaction, sig: DigitalSignature.LegallyIdentifiable) { - if (wtx.inputs.isEmpty()) return // Can choose any Notary if there are no inputs - val notary = serviceHub.loadState(wtx.inputs.first()).notary - check(sig.signer == notary) { "Transaction not signed by the required Notary" } - } - @Suspendable protected abstract fun validateHandshake(handshake: Handshake): Handshake @Suspendable protected abstract fun assembleSharedTX(handshake: Handshake): Pair> } diff --git a/node/src/test/kotlin/com/r3corda/node/messaging/TwoPartyTradeProtocolTests.kt b/node/src/test/kotlin/com/r3corda/node/messaging/TwoPartyTradeProtocolTests.kt index ab02f5f48e..99a047ae52 100644 --- a/node/src/test/kotlin/com/r3corda/node/messaging/TwoPartyTradeProtocolTests.kt +++ b/node/src/test/kotlin/com/r3corda/node/messaging/TwoPartyTradeProtocolTests.kt @@ -306,9 +306,7 @@ class TwoPartyTradeProtocolTests { TxRecord.Get(bobsFakeCash[1].id), TxRecord.Get(bobsFakeCash[2].id), // Alice notices that Bob's cash txns depend on a third tx she also doesn't know. She asks, Bob answers. - TxRecord.Get(bobsFakeCash[0].id), - // Bob wants to verify that the tx has been signed by the correct Notary, which requires looking up an input state - TxRecord.Get(bobsFakeCash[1].id) + TxRecord.Get(bobsFakeCash[0].id) ) // Bob has downloaded the attachment.