From 6c9222ad6ade08288d8c39aa90169a24a63cf030 Mon Sep 17 00:00:00 2001 From: Mike Hearn Date: Mon, 18 Apr 2016 14:51:40 +0200 Subject: [PATCH] Minor: delete some unnecessary code from LedgerTransaction --- core/src/main/kotlin/core/Transactions.kt | 26 ------------------- src/test/kotlin/core/TransactionGroupTests.kt | 2 +- 2 files changed, 1 insertion(+), 27 deletions(-) diff --git a/core/src/main/kotlin/core/Transactions.kt b/core/src/main/kotlin/core/Transactions.kt index 24a0efafec..3ce2ccf035 100644 --- a/core/src/main/kotlin/core/Transactions.kt +++ b/core/src/main/kotlin/core/Transactions.kt @@ -323,30 +323,4 @@ data class LedgerTransaction( ) { @Suppress("UNCHECKED_CAST") fun outRef(index: Int) = StateAndRef(outputs[index] as T, StateRef(hash, index)) - - fun toWireTransaction(): WireTransaction { - val wtx = WireTransaction(inputs, attachments.map { it.id }, outputs, commands.map { Command(it.value, it.signers) }) - check(wtx.serialize().hash == hash) - return wtx - } - - /** - * Converts this transaction to [SignedTransaction] form, optionally using the provided keys to sign. There is - * no requirement that [andSignWithKeys] include all required keys. - * - * @throws IllegalArgumentException if a key is provided that isn't listed in any command and [allowUnusedKeys] - * is false. - */ - fun toSignedTransaction(andSignWithKeys: List = emptyList(), allowUnusedKeys: Boolean = false): SignedTransaction { - val allPubKeys = commands.flatMap { it.signers }.toSet() - val wtx = toWireTransaction() - val bits = wtx.serialize() - val sigs = ArrayList() - for (key in andSignWithKeys) { - if (!allPubKeys.contains(key.public) && !allowUnusedKeys) - throw IllegalArgumentException("Key provided that is not listed by any command") - sigs += key.signWithECDSA(bits) - } - return wtx.toSignedTransaction(sigs) - } } \ No newline at end of file diff --git a/src/test/kotlin/core/TransactionGroupTests.kt b/src/test/kotlin/core/TransactionGroupTests.kt index c01328ef3a..a16860341d 100644 --- a/src/test/kotlin/core/TransactionGroupTests.kt +++ b/src/test/kotlin/core/TransactionGroupTests.kt @@ -67,7 +67,7 @@ class TransactionGroupTests { verify() } assertEquals(StateRef(t.id, 0), e.conflictRef) - assertEquals(setOf(conflict1, conflict2), setOf(e.tx1.toWireTransaction(), e.tx2.toWireTransaction())) + assertEquals(setOf(conflict1.id, conflict2.id), setOf(e.tx1.hash, e.tx2.hash)) } }