sweep: use scripthash rpc
This commit is contained in:
parent
5127dabb0d
commit
fefcd7bbcd
|
@ -878,14 +878,12 @@ class Abstract_Wallet(PrintError):
|
||||||
txin_type, privkey, compressed = bitcoin.deserialize_privkey(sec)
|
txin_type, privkey, compressed = bitcoin.deserialize_privkey(sec)
|
||||||
pubkey = bitcoin.public_key_from_private_key(privkey, compressed)
|
pubkey = bitcoin.public_key_from_private_key(privkey, compressed)
|
||||||
address = bitcoin.pubkey_to_address(txin_type, pubkey)
|
address = bitcoin.pubkey_to_address(txin_type, pubkey)
|
||||||
u = network.synchronous_get(('blockchain.address.listunspent', [address]))
|
sh = bitcoin.address_to_scripthash(address)
|
||||||
pay_script = bitcoin.address_to_script(address)
|
u = network.synchronous_get(('blockchain.scripthash.listunspent', [sh]))
|
||||||
for item in u:
|
for item in u:
|
||||||
if len(inputs) >= imax:
|
if len(inputs) >= imax:
|
||||||
break
|
break
|
||||||
item['type'] = txin_type
|
item['type'] = txin_type
|
||||||
item['scriptPubKey'] = pay_script
|
|
||||||
item['redeemPubkey'] = pubkey
|
|
||||||
item['address'] = address
|
item['address'] = address
|
||||||
item['prevout_hash'] = item['tx_hash']
|
item['prevout_hash'] = item['tx_hash']
|
||||||
item['prevout_n'] = item['tx_pos']
|
item['prevout_n'] = item['tx_pos']
|
||||||
|
|
Loading…
Reference in New Issue