wallet.mktx: add new args: rbf, nonlocal_only
used on lightning branch
This commit is contained in:
parent
e8bc025f5c
commit
10a4c7a6ed
@ -768,7 +768,7 @@ class AddressSynchronizer(PrintError):
|
||||
return c, u, x
|
||||
|
||||
@with_local_height_cached
|
||||
def get_utxos(self, domain=None, excluded=None, mature=False, confirmed_only=False):
|
||||
def get_utxos(self, domain=None, excluded=None, mature=False, confirmed_only=False, nonlocal_only=False):
|
||||
coins = []
|
||||
if domain is None:
|
||||
domain = self.get_addresses()
|
||||
@ -780,6 +780,8 @@ class AddressSynchronizer(PrintError):
|
||||
for x in utxos.values():
|
||||
if confirmed_only and x['height'] <= 0:
|
||||
continue
|
||||
if nonlocal_only and x['height'] == TX_HEIGHT_LOCAL:
|
||||
continue
|
||||
if mature and x['coinbase'] and x['height'] + COINBASE_MATURITY > self.get_local_height():
|
||||
continue
|
||||
coins.append(x)
|
||||
|
||||
@ -363,9 +363,13 @@ class Abstract_Wallet(AddressSynchronizer):
|
||||
|
||||
return tx_hash, status, label, can_broadcast, can_bump, amount, fee, height, conf, timestamp, exp_n
|
||||
|
||||
def get_spendable_coins(self, domain, config):
|
||||
def get_spendable_coins(self, domain, config, *, nonlocal_only=False):
|
||||
confirmed_only = config.get('confirmed_only', False)
|
||||
return self.get_utxos(domain, excluded=self.frozen_addresses, mature=True, confirmed_only=confirmed_only)
|
||||
return self.get_utxos(domain,
|
||||
excluded=self.frozen_addresses,
|
||||
mature=True,
|
||||
confirmed_only=confirmed_only,
|
||||
nonlocal_only=nonlocal_only)
|
||||
|
||||
def dummy_address(self):
|
||||
return self.get_receiving_addresses()[0]
|
||||
@ -612,9 +616,11 @@ class Abstract_Wallet(AddressSynchronizer):
|
||||
run_hook('make_unsigned_transaction', self, tx)
|
||||
return tx
|
||||
|
||||
def mktx(self, outputs, password, config, fee=None, change_addr=None, domain=None):
|
||||
coins = self.get_spendable_coins(domain, config)
|
||||
def mktx(self, outputs, password, config, fee=None, change_addr=None,
|
||||
domain=None, rbf=False, nonlocal_only=False):
|
||||
coins = self.get_spendable_coins(domain, config, nonlocal_only=nonlocal_only)
|
||||
tx = self.make_unsigned_transaction(coins, outputs, config, fee, change_addr)
|
||||
tx.set_rbf(rbf)
|
||||
self.sign_transaction(tx, password)
|
||||
return tx
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user