3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-01-30 23:02:15 +00:00

Fix off by one error in SIGHASH_SINGLE code. Resolves issue 292.

This commit is contained in:
Mike Hearn 2013-01-28 16:31:04 +01:00
parent dece35e95c
commit 1d6a8c908c

View File

@ -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<TransactionOutput>(this.outputs.subList(0, inputIndex));
this.outputs = new ArrayList<TransactionOutput>(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.