Skip to content

Commit faff3f3

Browse files
author
MarcoFalke
committed
test: Add txin.sequence option to MiniWallet
1 parent e87fbee commit faff3f3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

test/functional/test_framework/wallet.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,13 @@ def get_utxo(self, *, txid: Optional[str]='', mark_as_spent=True):
124124
else:
125125
return self._utxos[index]
126126

127-
def send_self_transfer(self, *, fee_rate=Decimal("0.003"), from_node, utxo_to_spend=None, locktime=0):
127+
def send_self_transfer(self, **kwargs):
128128
"""Create and send a tx with the specified fee_rate. Fee may be exact or at most one satoshi higher than needed."""
129-
tx = self.create_self_transfer(fee_rate=fee_rate, from_node=from_node, utxo_to_spend=utxo_to_spend)
130-
self.sendrawtransaction(from_node=from_node, tx_hex=tx['hex'])
129+
tx = self.create_self_transfer(**kwargs)
130+
self.sendrawtransaction(from_node=kwargs['from_node'], tx_hex=tx['hex'])
131131
return tx
132132

133-
def create_self_transfer(self, *, fee_rate=Decimal("0.003"), from_node, utxo_to_spend=None, mempool_valid=True, locktime=0):
133+
def create_self_transfer(self, *, fee_rate=Decimal("0.003"), from_node, utxo_to_spend=None, mempool_valid=True, locktime=0, sequence=0):
134134
"""Create and return a tx with the specified fee_rate. Fee may be exact or at most one satoshi higher than needed."""
135135
self._utxos = sorted(self._utxos, key=lambda k: k['value'])
136136
utxo_to_spend = utxo_to_spend or self._utxos.pop() # Pick the largest utxo (if none provided) and hope it covers the fee
@@ -140,7 +140,7 @@ def create_self_transfer(self, *, fee_rate=Decimal("0.003"), from_node, utxo_to_
140140
assert send_value > 0
141141

142142
tx = CTransaction()
143-
tx.vin = [CTxIn(COutPoint(int(utxo_to_spend['txid'], 16), utxo_to_spend['vout']))]
143+
tx.vin = [CTxIn(COutPoint(int(utxo_to_spend['txid'], 16), utxo_to_spend['vout']), nSequence=sequence)]
144144
tx.vout = [CTxOut(int(send_value * COIN), self._scriptPubKey)]
145145
tx.nLockTime = locktime
146146
if not self._address:

0 commit comments

Comments
 (0)