Skip to content

Commit cebc5af

Browse files
committed
txbatcher: allow duplicate outputs
1 parent 11c41bd commit cebc5af

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

electrum/txbatcher.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,14 @@ def to_pay_after(self, tx):
153153
# fixme: not robust to client restart, because we do not persist batch_payments
154154
if not tx:
155155
return self.batch_payments
156-
# not robust to duplicates
157-
return [x for x in self.batch_payments if x not in tx.outputs()]
156+
to_pay = []
157+
outputs = copy.deepcopy(tx.outputs())
158+
for x in self.batch_payments:
159+
if x not in outputs:
160+
to_pay.append(x)
161+
else:
162+
outputs.remove(x)
163+
return to_pay
158164

159165
def to_sweep_after(self, tx):
160166
tx_prevouts = set(txin.prevout for txin in tx.inputs()) if tx else set()

0 commit comments

Comments
 (0)