wallet: (trivial) add asserts re args in bump_fee and friends
for clearer exceptions in case of bugs related https://github.com/spesmilo/electrum/issues/8571
This commit is contained in:
@@ -1858,6 +1858,7 @@ class PartialTransaction(Transaction):
|
||||
|
||||
@classmethod
|
||||
def from_tx(cls, tx: Transaction) -> 'PartialTransaction':
|
||||
assert tx
|
||||
res = cls()
|
||||
res._inputs = [PartialTxInput.from_txin(txin, strip_witness=True)
|
||||
for txin in tx.inputs()]
|
||||
|
||||
@@ -2073,6 +2073,7 @@ class Abstract_Wallet(ABC, Logger, EventListener):
|
||||
note: it is the caller's responsibility to have already called tx.add_info_from_network().
|
||||
Without that, all txins must be ismine.
|
||||
"""
|
||||
assert tx
|
||||
if not isinstance(tx, PartialTransaction):
|
||||
tx = PartialTransaction.from_tx(tx)
|
||||
assert isinstance(tx, PartialTransaction)
|
||||
@@ -2300,6 +2301,7 @@ class Abstract_Wallet(ABC, Logger, EventListener):
|
||||
return True
|
||||
|
||||
def cpfp(self, tx: Transaction, fee: int) -> Optional[PartialTransaction]:
|
||||
assert tx
|
||||
txid = tx.txid()
|
||||
for i, o in enumerate(tx.outputs()):
|
||||
address, value = o.address, o.value
|
||||
@@ -2335,6 +2337,7 @@ class Abstract_Wallet(ABC, Logger, EventListener):
|
||||
note: it is the caller's responsibility to have already called tx.add_info_from_network().
|
||||
Without that, all txins must be ismine.
|
||||
"""
|
||||
assert tx
|
||||
if not isinstance(tx, PartialTransaction):
|
||||
tx = PartialTransaction.from_tx(tx)
|
||||
assert isinstance(tx, PartialTransaction)
|
||||
|
||||
Reference in New Issue
Block a user