Skip to content

Commit

Permalink
Merge pull request #3581 from SomberNight/bip_li01_sort_rbf_sweep
Browse files Browse the repository at this point in the history
RBF/sweep: use BIP_LI01_sort()
  • Loading branch information
ecdsa committed Dec 22, 2017
2 parents fc574ee + e2c05c2 commit 13bf539
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def sweep(privkeys, network, config, recipient, fee=None, imax=100):
locktime = network.get_local_height()

tx = Transaction.from_io(inputs, outputs, locktime=locktime)
tx.BIP_LI01_sort()
tx.set_rbf(True)
tx.sign(keypairs)
return tx
Expand Down Expand Up @@ -1080,7 +1081,9 @@ def bump_fee(self, tx, delta):
if delta > 0:
raise BaseException(_('Cannot bump fee: could not find suitable outputs'))
locktime = self.get_local_height()
return Transaction.from_io(inputs, outputs, locktime=locktime)
tx_new = Transaction.from_io(inputs, outputs, locktime=locktime)
tx_new.BIP_LI01_sort()
return tx_new

def cpfp(self, tx, fee):
txid = tx.txid()
Expand All @@ -1098,6 +1101,7 @@ def cpfp(self, tx, fee):
inputs = [item]
outputs = [(TYPE_ADDRESS, address, value - fee)]
locktime = self.get_local_height()
# note: no need to call tx.BIP_LI01_sort() here - single input/output
return Transaction.from_io(inputs, outputs, locktime=locktime)

def add_input_info(self, txin):
Expand Down

0 comments on commit 13bf539

Please sign in to comment.