Browse Source

wallet.bump_fee: (fix) make sure input signatures are removed

bump_fee was returning an invalid tx if its input was a
PartialTransaction that had signatures. It was relying on
line 1441 to remove signatures.

Relatedly, the WalletDB used to store such PartialTransactions as
PartialTransaction objects, but only until the program was restarted.
This is because serialising and de-serialising such a tx results in a
Transaction object.

So, combining these two, to reproduce a bug:
- create a tx, sign it, save as local
- bump fee, sign it, save as local
- bump fee --> tx already signed!? --> has old sigs, so it is invalid
patch-4
SomberNight 4 years ago
parent
commit
b080df9cff
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 1
      electrum/wallet.py
  2. 2
      electrum/wallet_db.py

1
electrum/wallet.py

@ -1440,6 +1440,7 @@ class Abstract_Wallet(AddressSynchronizer, ABC):
if not isinstance(tx, PartialTransaction):
tx = PartialTransaction.from_tx(tx)
assert isinstance(tx, PartialTransaction)
tx.remove_signatures()
if tx.is_final():
raise CannotBumpFee(_('Transaction is final'))
new_fee_rate = quantize_feerate(new_fee_rate) # strip excess precision

2
electrum/wallet_db.py

@ -968,6 +968,8 @@ class WalletDB(JsonDB):
assert isinstance(tx_hash, str)
assert isinstance(tx, Transaction), tx
# note that tx might be a PartialTransaction
# serialize and de-serialize tx now. this might e.g. convert a complete PartialTx to a Tx
tx = tx_from_any(str(tx))
if not tx_hash:
raise Exception("trying to add tx to db without txid")
if tx_hash != tx.txid():

Loading…
Cancel
Save