1
0

bound number of tx inputs in sweep

This commit is contained in:
ThomasV
2016-10-08 11:40:03 +02:00
parent 1e55f4fda0
commit 5d44474aeb
2 changed files with 9 additions and 5 deletions

View File

@@ -854,7 +854,7 @@ class Abstract_Wallet(PrintError):
self.sign_transaction(tx, password)
return tx
def sweep(self, privkeys, network, config, recipient, fee):
def sweep(self, privkeys, network, config, recipient, fee=None, imax=100):
inputs = []
keypairs = {}
for privkey in privkeys:
@@ -863,6 +863,8 @@ class Abstract_Wallet(PrintError):
u = network.synchronous_get(('blockchain.address.listunspent', [address]))
pay_script = Transaction.pay_script(TYPE_ADDRESS, address)
for item in u:
if len(inputs) >= imax:
break
item['scriptPubKey'] = pay_script
item['redeemPubkey'] = pubkey
item['address'] = address
@@ -872,7 +874,7 @@ class Abstract_Wallet(PrintError):
item['x_pubkeys'] = [pubkey]
item['signatures'] = [None]
item['num_sig'] = 1
inputs += u
inputs.append(item)
keypairs[pubkey] = privkey
if not inputs: