@@ -124,13 +124,13 @@ def get_utxo(self, *, txid: Optional[str]='', mark_as_spent=True):
124
124
else :
125
125
return self ._utxos [index ]
126
126
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 ):
128
128
"""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' ])
131
131
return tx
132
132
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 ):
134
134
"""Create and return a tx with the specified fee_rate. Fee may be exact or at most one satoshi higher than needed."""
135
135
self ._utxos = sorted (self ._utxos , key = lambda k : k ['value' ])
136
136
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_
140
140
assert send_value > 0
141
141
142
142
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 )]
144
144
tx .vout = [CTxOut (int (send_value * COIN ), self ._scriptPubKey )]
145
145
tx .nLockTime = locktime
146
146
if not self ._address :
0 commit comments