Skip to content

Commit fa29245

Browse files
author
MacroFake
committed
test: Allow setting sequence per input in MiniWallet create_self_transfer_multi
Previously it was only possible to set the same sequence in all inputs
1 parent fac3800 commit fa29245

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

test/functional/test_framework/wallet.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,17 @@ def create_self_transfer_multi(
242242
set by amount_per_output or automatically calculated with a fee_per_output.
243243
"""
244244
utxos_to_spend = utxos_to_spend or [self.get_utxo()]
245+
sequence = [sequence] * len(utxos_to_spend) if type(sequence) is int else sequence
246+
assert_equal(len(utxos_to_spend), len(sequence))
245247
# create simple tx template (1 input, 1 output)
246248
tx = self.create_self_transfer(
247249
fee_rate=0,
248-
utxo_to_spend=utxos_to_spend[0], sequence=sequence)["tx"]
250+
utxo_to_spend=utxos_to_spend[0])["tx"]
249251

250252
# duplicate inputs, witnesses and outputs
251253
tx.vin = [deepcopy(tx.vin[0]) for _ in range(len(utxos_to_spend))]
254+
for txin, seq in zip(tx.vin, sequence):
255+
txin.nSequence = seq
252256
tx.wit.vtxinwit = [deepcopy(tx.wit.vtxinwit[0]) for _ in range(len(utxos_to_spend))]
253257
tx.vout = [deepcopy(tx.vout[0]) for _ in range(num_outputs)]
254258

0 commit comments

Comments
 (0)