sending fixed
This commit is contained in:
@@ -102,7 +102,7 @@ class CoinChooserBase(PrintError):
|
||||
value = sum(coin['value'] for coin in coins)
|
||||
return Bucket(desc, size, value, coins)
|
||||
|
||||
return map(make_Bucket, buckets.keys(), buckets.values())
|
||||
return list(map(make_Bucket, buckets.keys(), buckets.values()))
|
||||
|
||||
def penalty_func(self, tx):
|
||||
def penalty(candidate):
|
||||
@@ -128,7 +128,7 @@ class CoinChooserBase(PrintError):
|
||||
s = str(val)
|
||||
return len(s) - len(s.rstrip('0'))
|
||||
|
||||
zeroes = map(trailing_zeroes, output_amounts)
|
||||
zeroes = [trailing_zeroes(i) for i in output_amounts]
|
||||
min_zeroes = min(zeroes)
|
||||
max_zeroes = max(zeroes)
|
||||
zeroes = range(max(0, min_zeroes - 1), (max_zeroes + 1) + 1)
|
||||
@@ -137,7 +137,7 @@ class CoinChooserBase(PrintError):
|
||||
remaining = change_amount
|
||||
amounts = []
|
||||
while n > 1:
|
||||
average = remaining // n
|
||||
average = remaining / n
|
||||
amount = self.p.randint(int(average * 0.7), int(average * 1.3))
|
||||
precision = min(self.p.choice(zeroes), int(floor(log10(amount))))
|
||||
amount = int(round(amount, -precision))
|
||||
@@ -214,6 +214,9 @@ class CoinChooserBase(PrintError):
|
||||
|
||||
return tx
|
||||
|
||||
def choose_buckets(self, buckets, sufficient_funds, penalty_func):
|
||||
raise NotImplemented('To be subclassed')
|
||||
|
||||
class CoinChooserOldestFirst(CoinChooserBase):
|
||||
'''Maximize transaction priority. Select the oldest unspent
|
||||
transaction outputs in your wallet, that are sufficient to cover
|
||||
|
||||
@@ -602,8 +602,8 @@ class Commands:
|
||||
else:
|
||||
f = None
|
||||
if f is not None:
|
||||
out = filter(lambda x: x.get('status')==f, out)
|
||||
return map(self._format_request, out)
|
||||
out = list(filter(lambda x: x.get('status')==f, out))
|
||||
return list(map(self._format_request, out))
|
||||
|
||||
@command('w')
|
||||
def getunusedaddress(self,force=False):
|
||||
|
||||
@@ -57,7 +57,7 @@ class KeyStore(PrintError):
|
||||
if num_sig is None:
|
||||
continue
|
||||
x_signatures = txin['signatures']
|
||||
signatures = filter(None, x_signatures)
|
||||
signatures = [sig for sig in x_signatures if sig]
|
||||
if len(signatures) == num_sig:
|
||||
# input is complete
|
||||
continue
|
||||
@@ -667,7 +667,7 @@ def is_address_list(text):
|
||||
def get_private_keys(text):
|
||||
parts = text.split('\n')
|
||||
parts = map(lambda x: ''.join(x.split()), parts)
|
||||
parts = filter(bool, parts)
|
||||
parts = list(filter(bool, parts))
|
||||
if bool(parts) and all(bitcoin.is_private_key(x) for x in parts):
|
||||
return parts
|
||||
|
||||
|
||||
@@ -814,7 +814,7 @@ class Transaction:
|
||||
num = txin['num_sig']
|
||||
pubkeys, x_pubkeys = self.get_sorted_pubkeys(txin)
|
||||
for j, x_pubkey in enumerate(x_pubkeys):
|
||||
signatures = filter(None, txin['signatures'])
|
||||
signatures = list(filter(None, txin['signatures']))
|
||||
if len(signatures) == num:
|
||||
# txin is complete
|
||||
break
|
||||
|
||||
@@ -1028,7 +1028,7 @@ class Abstract_Wallet(PrintError):
|
||||
txin['signatures'] = [None] * len(txin['signatures'])
|
||||
self.add_input_info(txin)
|
||||
# use own outputs
|
||||
s = filter(lambda x: self.is_mine(x[1]), outputs)
|
||||
s = list(filter(lambda x: self.is_mine(x[1]), outputs))
|
||||
# ... unless there is none
|
||||
if not s:
|
||||
s = outputs
|
||||
|
||||
Reference in New Issue
Block a user