wallet.mktx: add new args: rbf, nonlocal_only
used on lightning branch
This commit is contained in:
@@ -768,7 +768,7 @@ class AddressSynchronizer(PrintError):
|
|||||||
return c, u, x
|
return c, u, x
|
||||||
|
|
||||||
@with_local_height_cached
|
@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 = []
|
coins = []
|
||||||
if domain is None:
|
if domain is None:
|
||||||
domain = self.get_addresses()
|
domain = self.get_addresses()
|
||||||
@@ -780,6 +780,8 @@ class AddressSynchronizer(PrintError):
|
|||||||
for x in utxos.values():
|
for x in utxos.values():
|
||||||
if confirmed_only and x['height'] <= 0:
|
if confirmed_only and x['height'] <= 0:
|
||||||
continue
|
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():
|
if mature and x['coinbase'] and x['height'] + COINBASE_MATURITY > self.get_local_height():
|
||||||
continue
|
continue
|
||||||
coins.append(x)
|
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
|
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)
|
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):
|
def dummy_address(self):
|
||||||
return self.get_receiving_addresses()[0]
|
return self.get_receiving_addresses()[0]
|
||||||
@@ -612,9 +616,11 @@ class Abstract_Wallet(AddressSynchronizer):
|
|||||||
run_hook('make_unsigned_transaction', self, tx)
|
run_hook('make_unsigned_transaction', self, tx)
|
||||||
return tx
|
return tx
|
||||||
|
|
||||||
def mktx(self, outputs, password, config, fee=None, change_addr=None, domain=None):
|
def mktx(self, outputs, password, config, fee=None, change_addr=None,
|
||||||
coins = self.get_spendable_coins(domain, config)
|
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 = self.make_unsigned_transaction(coins, outputs, config, fee, change_addr)
|
||||||
|
tx.set_rbf(rbf)
|
||||||
self.sign_transaction(tx, password)
|
self.sign_transaction(tx, password)
|
||||||
return tx
|
return tx
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user