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
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user