bump_dee and dscancel: call tx.estimated_size() after add_input_info().
This is a workaround, see the FIXME. PartialTxInput.is_segwit() should return the correct value, or raise if information is missing.
This commit is contained in:
@@ -1171,6 +1171,10 @@ class PartialTxInput(TxInput, PSBTSection):
|
||||
|
||||
@classmethod
|
||||
def from_txin(cls, txin: TxInput, *, strip_witness: bool = True) -> 'PartialTxInput':
|
||||
# FIXME: if strip_witness is True, res.is_segwit() will return False,
|
||||
# and res.estimated_size() will return an incorrect value. These methods
|
||||
# will return the correct values after we call add_input_info(). (see dscancel and bump_fee)
|
||||
# This is very fragile: the value returned by estimate_size() depends on the calling order.
|
||||
res = PartialTxInput(prevout=txin.prevout,
|
||||
script_sig=None if strip_witness else txin.script_sig,
|
||||
nsequence=txin.nsequence,
|
||||
|
||||
@@ -1394,12 +1394,12 @@ class Abstract_Wallet(AddressSynchronizer, ABC):
|
||||
if tx.is_final():
|
||||
raise CannotBumpFee(_('Transaction is final'))
|
||||
new_fee_rate = quantize_feerate(new_fee_rate) # strip excess precision
|
||||
old_tx_size = tx.estimated_size()
|
||||
try:
|
||||
# note: this might download input utxos over network
|
||||
tx.add_info_from_wallet(self, ignore_network_issues=False)
|
||||
except NetworkException as e:
|
||||
raise CannotBumpFee(repr(e))
|
||||
old_tx_size = tx.estimated_size()
|
||||
old_fee = tx.get_fee()
|
||||
assert old_fee is not None
|
||||
old_fee_rate = old_fee / old_tx_size # sat/vbyte
|
||||
@@ -1573,12 +1573,12 @@ class Abstract_Wallet(AddressSynchronizer, ABC):
|
||||
if tx.is_final():
|
||||
raise CannotDoubleSpendTx(_('Transaction is final'))
|
||||
new_fee_rate = quantize_feerate(new_fee_rate) # strip excess precision
|
||||
old_tx_size = tx.estimated_size()
|
||||
try:
|
||||
# note: this might download input utxos over network
|
||||
tx.add_info_from_wallet(self, ignore_network_issues=False)
|
||||
except NetworkException as e:
|
||||
raise CannotDoubleSpendTx(repr(e))
|
||||
old_tx_size = tx.estimated_size()
|
||||
old_fee = tx.get_fee()
|
||||
assert old_fee is not None
|
||||
old_fee_rate = old_fee / old_tx_size # sat/vbyte
|
||||
|
||||
Reference in New Issue
Block a user