mirror of
https://github.com/corda/corda.git
synced 2025-02-20 09:26:41 +00:00
Merged in andrius-cleanup-tweaks (pull request #208)
Remove the "verify correct notary has signed" check from TwoParty protocols
This commit is contained in:
commit
c442cd01a7
@ -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<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.
|
||||
|
@ -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<U>): Handshake<U>
|
||||
@Suspendable protected abstract fun assembleSharedTX(handshake: Handshake<U>): Pair<TransactionBuilder, List<PublicKey>>
|
||||
}
|
||||
|
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user