Commands must have at least one pubkey.

This commit is contained in:
Mike Hearn 2016-01-07 14:54:56 +01:00
parent 992b56a2b2
commit 0d0e75e6ff
2 changed files with 6 additions and 3 deletions

View File

@ -75,6 +75,9 @@ abstract class TypeOnlyCommandData : CommandData {
/** Command data/content plus pubkey pair: the signature is stored at the end of the serialized bytes */
data class Command(val data: CommandData, val pubkeys: List<PublicKey>) {
init {
require(pubkeys.isNotEmpty())
}
constructor(data: CommandData, key: PublicKey) : this(data, listOf(key))
}
@ -88,7 +91,7 @@ data class AuthenticatedObject<out T : Any>(
/**
* If present in a transaction, contains a time that was verified by the timestamping authority/authorities whose
* public keys are identified in the containing [Command] object.
* public keys are identified in the containing [Command] object. The true time must be between (after, before)
*/
data class TimestampCommand(val after: Instant?, val before: Instant?) : CommandData {
init {

View File

@ -75,7 +75,7 @@ class CashTests {
transaction {
input { DummyContract.State() }
output { outState }
arg { Cash.Commands.Move() }
arg(MINI_CORP_PUBKEY) { Cash.Commands.Move() }
this `fails requirement` "there is at least one cash input"
}
@ -84,7 +84,7 @@ class CashTests {
// institution is allowed to issue as much cash as they want.
transaction {
output { outState }
arg { Cash.Commands.Issue() }
arg(DUMMY_PUBKEY_1) { Cash.Commands.Issue() }
this `fails requirement` "output deposits are owned by a command signer"
}
transaction {