mirror of
https://github.com/corda/corda.git
synced 2025-04-07 19:34:41 +00:00
Remove the "verify correct notary has signed" check. This is no longed necessary as the required notary key is added to the "signers" list during transaction construction. We have general validation rules that check the correct notary was included in the signers list, and that we have signatures for all "signers".
This commit is contained in:
parent
9e174d3e3a
commit
b498928f75
@ -202,9 +202,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()
|
||||
|
||||
@ -260,11 +257,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<TransactionBuilder, List<PublicKey>> {
|
||||
val ptx = TransactionType.General.Builder()
|
||||
// Add input and output states for the movement of cash, by using the Cash contract to generate the states.
|
||||
|
@ -218,7 +218,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()
|
||||
|
||||
@ -263,12 +262,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<U>): Handshake<U>
|
||||
@Suspendable protected abstract fun assembleSharedTX(handshake: Handshake<U>): Pair<TransactionBuilder, List<PublicKey>>
|
||||
}
|
||||
|
@ -305,9 +305,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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user