From 1d6a8c908cfe187ac256998f75996eafeba9d4a6 Mon Sep 17 00:00:00 2001 From: Mike Hearn Date: Mon, 28 Jan 2013 16:31:04 +0100 Subject: [PATCH] Fix off by one error in SIGHASH_SINGLE code. Resolves issue 292. --- core/src/main/java/com/google/bitcoin/core/Transaction.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/com/google/bitcoin/core/Transaction.java b/core/src/main/java/com/google/bitcoin/core/Transaction.java index bf136a90..49b303c2 100644 --- a/core/src/main/java/com/google/bitcoin/core/Transaction.java +++ b/core/src/main/java/com/google/bitcoin/core/Transaction.java @@ -850,7 +850,7 @@ public class Transaction extends ChildMessage implements Serializable { } // In SIGHASH_SINGLE the outputs after the matching input index are deleted, and the outputs before // that position are "nulled out". Unintuitively, the value in a "null" transaction is set to -1. - this.outputs = new ArrayList(this.outputs.subList(0, inputIndex)); + this.outputs = new ArrayList(this.outputs.subList(0, inputIndex + 1)); for (int i = 0; i < inputIndex; i++) this.outputs.set(i, new TransactionOutput(params, this, BigInteger.valueOf(-1), new byte[] {})); // The signature isn't broken by new versions of the transaction issued by other parties.