electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 10a4c7a6ed929f108e347350cb8a3fbaf928c59b
parent e8bc025f5cbcd82590800bcbd195861a45d42edd
Author: SomberNight <somber.night@protonmail.com>
Date:   Fri, 19 Oct 2018 20:48:48 +0200

wallet.mktx: add new args: rbf, nonlocal_only

used on lightning branch

Diffstat:
Melectrum/address_synchronizer.py | 4+++-
Melectrum/wallet.py | 14++++++++++----
2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/electrum/address_synchronizer.py b/electrum/address_synchronizer.py @@ -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) diff --git a/electrum/wallet.py b/electrum/wallet.py @@ -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