From cf4c469e6e76b94a2cc50d6df1827e5e6b4d8591 Mon Sep 17 00:00:00 2001 From: Mike Hearn Date: Thu, 25 Jul 2013 15:30:49 +0200 Subject: [PATCH] TransactionInput: treat duplicate connection attempts as a success. --- .../main/java/com/google/bitcoin/core/TransactionInput.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/com/google/bitcoin/core/TransactionInput.java b/core/src/main/java/com/google/bitcoin/core/TransactionInput.java index 2fc50cf5..f3bacf47 100644 --- a/core/src/main/java/com/google/bitcoin/core/TransactionInput.java +++ b/core/src/main/java/com/google/bitcoin/core/TransactionInput.java @@ -325,7 +325,10 @@ public class TransactionInput extends ChildMessage implements Serializable { checkElementIndex((int) outpoint.getIndex(), transaction.getOutputs().size(), "Corrupt transaction"); TransactionOutput out = transaction.getOutput((int) outpoint.getIndex()); if (!out.isAvailableForSpending()) { - if (mode == ConnectMode.DISCONNECT_ON_CONFLICT) { + if (out.parentTransaction.equals(outpoint.fromTx)) { + // Already connected. + return ConnectionResult.SUCCESS; + } else if (mode == ConnectMode.DISCONNECT_ON_CONFLICT) { out.markAsUnspent(); } else if (mode == ConnectMode.ABORT_ON_CONFLICT) { outpoint.fromTx = checkNotNull(out.parentTransaction);