mirror of
https://github.com/corda/corda.git
synced 2024-12-19 04:57:58 +00:00
Correct message when checking signing keys
The keys used to sign a command are tested for being a superset of the keys which own the states, not for being an exact match (as the text previously suggested). This corrects the message used if this requirement isn't met. Signed-off-by: Ross Nicoll <ross.nicoll@r3.com>
This commit is contained in:
parent
7cd281364f
commit
1fbad81773
@ -119,7 +119,7 @@ inline fun <reified T : MoveCommand> verifyMoveCommand(inputs: List<OwnableState
|
||||
val command = commands.requireSingleCommand<T>()
|
||||
val keysThatSigned = command.signers.toSet()
|
||||
requireThat {
|
||||
"the owning keys are the same as the signing keys" by keysThatSigned.containsAll(owningPubKeys)
|
||||
"the owning keys are a subset of the signing keys" by keysThatSigned.containsAll(owningPubKeys)
|
||||
}
|
||||
return command.value
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ class Obligation<P> : Contract {
|
||||
val owningPubKeys = inputs.filter { it is State<P> }.map { (it as State<P>).beneficiary }.toSet()
|
||||
val keysThatSigned = setLifecycleCommand.signers.toSet()
|
||||
requireThat {
|
||||
"the owning keys are the same as the signing keys" by keysThatSigned.containsAll(owningPubKeys)
|
||||
"the owning keys are a subset of the signing keys" by keysThatSigned.containsAll(owningPubKeys)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,7 @@ public class CashTestsJava {
|
||||
tx.tweak(tw -> {
|
||||
tw.output(outState);
|
||||
tw.command(getDUMMY_PUBKEY_2(), new Cash.Commands.Move());
|
||||
return tw.failsWith("the owning keys are the same as the signing keys");
|
||||
return tw.failsWith("the owning keys are a subset of the signing keys");
|
||||
});
|
||||
tx.tweak(tw -> {
|
||||
tw.output(outState);
|
||||
|
@ -99,7 +99,7 @@ class CashTests {
|
||||
tweak {
|
||||
output { outState }
|
||||
command(DUMMY_PUBKEY_2) { Cash.Commands.Move() }
|
||||
this `fails with` "the owning keys are the same as the signing keys"
|
||||
this `fails with` "the owning keys are a subset of the signing keys"
|
||||
}
|
||||
tweak {
|
||||
output { outState }
|
||||
|
@ -66,7 +66,7 @@ class ObligationTests {
|
||||
tweak {
|
||||
output { outState }
|
||||
command(DUMMY_PUBKEY_2) { Obligation.Commands.Move() }
|
||||
this `fails with` "the owning keys are the same as the signing keys"
|
||||
this `fails with` "the owning keys are a subset of the signing keys"
|
||||
}
|
||||
tweak {
|
||||
output { outState }
|
||||
|
Loading…
Reference in New Issue
Block a user