mirror of
https://github.com/corda/corda.git
synced 2025-02-21 01:42:24 +00:00
Minor: add a unit test to verify that duplicated inputs are forbidden (conflict) and delete the TODO for it.
This commit is contained in:
parent
7f13b8ab4a
commit
9681f97502
@ -165,10 +165,6 @@ data class TimestampedWireTransaction(
|
||||
* A LedgerTransaction wraps the data needed to calculate one or more successor states from a set of input states.
|
||||
* It is the first step after extraction from a WireTransaction. The signatures at this point have been lined up
|
||||
* with the commands from the wire, and verified/looked up.
|
||||
*
|
||||
* Not used yet.
|
||||
*
|
||||
* TODO: When converting LedgerTransaction into TransactionForVerification, make sure to check for duped inputs.
|
||||
*/
|
||||
data class LedgerTransaction(
|
||||
/** The input states which will be consumed/invalidated by the execution of this transaction. */
|
||||
|
@ -97,4 +97,25 @@ class TransactionGroupTests {
|
||||
}
|
||||
assertEquals(e.hash, ref.txhash)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun duplicatedInputs() {
|
||||
// Check that a transaction cannot refer to the same input more than once.
|
||||
transactionGroup {
|
||||
roots {
|
||||
transaction(A_THOUSAND_POUNDS label "£1000")
|
||||
}
|
||||
|
||||
transaction {
|
||||
input("£1000")
|
||||
input("£1000")
|
||||
output { A_THOUSAND_POUNDS.copy(amount = A_THOUSAND_POUNDS.amount * 2) }
|
||||
arg(MINI_CORP_KEY) { Cash.Commands.Move }
|
||||
}
|
||||
|
||||
assertFailsWith(TransactionConflictException::class) {
|
||||
verify()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user