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:
Ross Nicoll 2017-01-10 13:02:45 +00:00
parent 7cd281364f
commit 1fbad81773
5 changed files with 5 additions and 5 deletions

View File

@ -119,7 +119,7 @@ inline fun <reified T : MoveCommand> verifyMoveCommand(inputs: List<OwnableState
val command = commands.requireSingleCommand<T>() val command = commands.requireSingleCommand<T>()
val keysThatSigned = command.signers.toSet() val keysThatSigned = command.signers.toSet()
requireThat { 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 return command.value
} }

View File

@ -405,7 +405,7 @@ class Obligation<P> : Contract {
val owningPubKeys = inputs.filter { it is State<P> }.map { (it as State<P>).beneficiary }.toSet() val owningPubKeys = inputs.filter { it is State<P> }.map { (it as State<P>).beneficiary }.toSet()
val keysThatSigned = setLifecycleCommand.signers.toSet() val keysThatSigned = setLifecycleCommand.signers.toSet()
requireThat { 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)
} }
} }

View File

@ -38,7 +38,7 @@ public class CashTestsJava {
tx.tweak(tw -> { tx.tweak(tw -> {
tw.output(outState); tw.output(outState);
tw.command(getDUMMY_PUBKEY_2(), new Cash.Commands.Move()); 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 -> { tx.tweak(tw -> {
tw.output(outState); tw.output(outState);

View File

@ -99,7 +99,7 @@ class CashTests {
tweak { tweak {
output { outState } output { outState }
command(DUMMY_PUBKEY_2) { Cash.Commands.Move() } 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 { tweak {
output { outState } output { outState }

View File

@ -66,7 +66,7 @@ class ObligationTests {
tweak { tweak {
output { outState } output { outState }
command(DUMMY_PUBKEY_2) { Obligation.Commands.Move() } 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 { tweak {
output { outState } output { outState }