Splits verifySigs into verifySigsExcept and verifyRequiredSigs to clarify usage.

This commit is contained in:
Joel Dudley
2017-07-17 15:42:08 +01:00
committed by GitHub
parent 7d1d5cc0f8
commit b37c73827f
20 changed files with 75 additions and 67 deletions

View File

@ -474,14 +474,14 @@ public class FlowCookbookJava {
// We can verify that a transaction has all the required
// signatures, and that they're all valid, by running:
// DOCSTART 35
fullySignedTx.verifySignatures();
fullySignedTx.verifyRequiredSignatures();
// DOCEND 35
// If the transaction is only partially signed, we have to pass in
// a list of the public keys corresponding to the missing
// signatures, explicitly telling the system not to check them.
// DOCSTART 36
onceSignedTx.verifySignatures(counterpartyPubKey);
onceSignedTx.verifySignaturesExcept(counterpartyPubKey);
// DOCEND 36
// We can also choose to only check the signatures that are

View File

@ -60,7 +60,7 @@ class MyValidatingNotaryFlow(otherSide: Party, service: MyCustomValidatingNotary
private fun checkSignatures(stx: SignedTransaction) {
try {
stx.verifySignatures(serviceHub.myInfo.notaryIdentity.owningKey)
stx.verifySignaturesExcept(serviceHub.myInfo.notaryIdentity.owningKey)
} catch(e: SignatureException) {
throw NotaryException(NotaryError.TransactionInvalid(e))
}

View File

@ -457,14 +457,14 @@ object FlowCookbook {
// We can verify that a transaction has all the required
// signatures, and that they're all valid, by running:
// DOCSTART 35
fullySignedTx.verifySignatures()
fullySignedTx.verifyRequiredSignatures()
// DOCEND 35
// If the transaction is only partially signed, we have to pass in
// a list of the public keys corresponding to the missing
// signatures, explicitly telling the system not to check them.
// DOCSTART 36
onceSignedTx.verifySignatures(counterpartyPubKey)
onceSignedTx.verifySignaturesExcept(counterpartyPubKey)
// DOCEND 36
// We can also choose to only check the signatures that are

View File

@ -159,7 +159,7 @@ class ForeignExchangeFlow(val tradeId: String,
val allPartySignedTx = sendAndReceive<DigitalSignature.WithKey>(remoteRequestWithNotary.owner, signedTransaction).unwrap {
val withNewSignature = signedTransaction + it
// check all signatures are present except the notary
withNewSignature.verifySignatures(withNewSignature.tx.notary!!.owningKey)
withNewSignature.verifySignaturesExcept(withNewSignature.tx.notary!!.owningKey)
// This verifies that the transaction is contract-valid, even though it is missing signatures.
// In a full solution there would be states tracking the trade request which
@ -234,7 +234,7 @@ class ForeignExchangeRemoteFlow(val source: Party) : FlowLogic<Unit>() {
val proposedTrade = sendAndReceive<SignedTransaction>(source, ourResponse).unwrap {
val wtx = it.tx
// check all signatures are present except our own and the notary
it.verifySignatures(ourKey, wtx.notary!!.owningKey)
it.verifySignaturesExcept(ourKey, wtx.notary!!.owningKey)
// We need to fetch their complete input states and dependencies so that verify can operate
checkDependencies(it)

View File

@ -197,7 +197,7 @@ class SubmitCompletionFlow(val ref: StateRef, val verdict: WorkflowState) : Flow
val agreedTx = selfSignedTx + it
// Receive back their signature and confirm that it is for an unmodified transaction
// Also that the only missing signature is from teh Notary
agreedTx.verifySignatures(notary.owningKey)
agreedTx.verifySignaturesExcept(notary.owningKey)
// Recheck the data of the transaction. Note we run toLedgerTransaction on the WireTransaction
// as we do not have all the signature.
agreedTx.tx.toLedgerTransaction(serviceHub).verify()
@ -226,7 +226,7 @@ class RecordCompletionFlow(val source: Party) : FlowLogic<Unit>() {
// First we receive the verdict transaction signed by their single key
val completeTx = receive<SignedTransaction>(source).unwrap {
// Check the transaction is signed apart from our own key and the notary
val wtx = it.verifySignatures(serviceHub.myInfo.legalIdentity.owningKey, it.tx.notary!!.owningKey)
val wtx = it.verifySignaturesExcept(serviceHub.myInfo.legalIdentity.owningKey, it.tx.notary!!.owningKey)
// Check the transaction data is correctly formed
wtx.toLedgerTransaction(serviceHub).verify()
// Confirm that this is the expected type of transaction