@@ -1625,7 +1625,7 @@ def broadcast_signed_transaction(unsigned_tx, signatures, pubkeys, coin_symbol='
16251625
16261626
16271627def simple_spend (from_privkey , to_address , to_satoshis , change_address = None ,
1628- privkey_is_compressed = True , min_confirmations = 0 , api_key = None , coin_symbol = 'btc' ):
1628+ privkey_is_compressed = True , min_confirmations = 0 , api_key = None , coin_symbol = 'btc' , preference : str = 'high' ):
16291629 '''
16301630 Simple method to spend from one single-key address to another.
16311631
@@ -1641,6 +1641,9 @@ def simple_spend(from_privkey, to_address, to_satoshis, change_address=None,
16411641 Compressed public keys (and their corresponding addresses) have been the standard since v0.6,
16421642 set privkey_is_compressed=False if using uncompressed addresses.
16431643
1644+ Fee preferences can be passed as strings with the values 'low', 'medium', or 'high'.
1645+ Transaction with zero fees are unlikely to be added to a block and hence removed from choices.
1646+
16441647 Note that this currently only supports spending from single key addresses.
16451648 '''
16461649 assert is_valid_coin_symbol (coin_symbol ), coin_symbol
@@ -1674,6 +1677,7 @@ def simple_spend(from_privkey, to_address, to_satoshis, change_address=None,
16741677 verify_tosigntx = False , # will verify in next step
16751678 include_tosigntx = True ,
16761679 api_key = api_key ,
1680+ preference = preference if preference in ('high' , 'medium' , 'low' ) else 'high'
16771681 )
16781682 logger .info ('unsigned_tx: %s' % unsigned_tx )
16791683
@@ -1739,7 +1743,7 @@ def simple_spend(from_privkey, to_address, to_satoshis, change_address=None,
17391743
17401744
17411745def simple_spend_p2sh (all_from_pubkeys , from_privkeys_to_use , to_address , to_satoshis ,
1742- change_address = None , min_confirmations = 0 , api_key = None , coin_symbol = 'btc' ):
1746+ change_address = None , min_confirmations = 0 , api_key = None , coin_symbol = 'btc' , preference : str = 'high' ):
17431747 '''
17441748 Simple method to spend from a p2sh address.
17451749
@@ -1748,6 +1752,9 @@ def simple_spend_p2sh(all_from_pubkeys, from_privkeys_to_use, to_address, to_sat
17481752 from_privkeys_to_use is a list of all privkeys that will be used to sign the tx (and no more).
17491753 If the address is a 2-of-3 multisig and you supply 1 (or 3) from_privkeys_to_use this will break.
17501754
1755+ Fee preferences can be passed as strings with the values 'low', 'medium', or 'high'.
1756+ Transaction with zero fees are unlikely to be added to a block and hence removed from choices.
1757+
17511758 Signature takes place locally (client-side) after unsigned transaction is verified.
17521759
17531760 Returns the tx_hash of the newly broadcast tx.
@@ -1810,6 +1817,7 @@ def simple_spend_p2sh(all_from_pubkeys, from_privkeys_to_use, to_address, to_sat
18101817 verify_tosigntx = False , # will verify in next step
18111818 include_tosigntx = True ,
18121819 api_key = api_key ,
1820+ preference = preference if preference in ('high' , 'medium' , 'low' ) else 'high'
18131821 )
18141822 logger .info ('unsigned_tx: %s' % unsigned_tx )
18151823
0 commit comments