Test only change.
New test covers importaddress, importpubkey, importprivkey, and importmulti RPC's.
This was originally part of #9137, but I split it off because the test is useful on its own.
Covers importaddress, importpubkey, importprivkey, and importmulti RPCs.
0 | @@ -0,0 +1,163 @@ 1 | +#!/usr/bin/env python3 2 | +# Copyright (c) 2014-2016 The Bitcoin Core developers 3 | +# Distributed under the MIT software license, see the accompanying 4 | +# file COPYING or http://www.opensource.org/licenses/mit-license.php. 5 | + 6 | +from test_framework.test_framework import BitcoinTestFramework 7 | +from test_framework.util import *
nit: no wildcard import here.
Removed
Concept ACK
0 | @@ -0,0 +1,164 @@ 1 | +#!/usr/bin/env python3 2 | +# Copyright (c) 2014-2016 The Bitcoin Core developers 3 | +# Distributed under the MIT software license, see the accompanying 4 | +# file COPYING or http://www.opensource.org/licenses/mit-license.php. 5 | + 6 | +from test_framework.test_framework import BitcoinTestFramework 7 | +from test_framework.util import (start_nodes, connect_nodes, sync_blocks, 8 | + assert_equal, Decimal)
from decimal import Decimal
would be cleaner
Fixed.
73 | + # each possible type of wallet import RPC. 74 | + import_rpc_variants = [] 75 | + for i, import_rpc in enumerate(IMPORT_RPCS): 76 | + label = "label{}".format(i) 77 | + addr = self.nodes[0].validateaddress(self.nodes[0].getnewaddress( 78 | + label))
You don't have to be too strict about not exceeding 80 chars. I think 120 is preferred, but there does not seem to be a strict rule, so meh.
123 | + raw_tx = self.nodes[0].getrawtransaction(txid) 124 | + decoded_tx = self.nodes[0].decoderawtransaction(raw_tx) 125 | + input_vout = next( 126 | + out["n"] for out in decoded_tx["vout"] 127 | + if out["scriptPubKey"]["addresses"] == [addr["address"]]) 128 | + fee = self.nodes[0].getnetworkinfo()["relayfee"]
This probably does not change during the loop, so maybe cache it?
Done.
133 | + spend_txid = self.nodes[0].sendrawtransaction(signed_spend_tx[ 134 | + "hex"]) 135 | + spend_txids.append(spend_txid) 136 | + 137 | + self.nodes[0].generate(1) 138 | + sync_blocks(self.nodes)
Assert that the transaction pool is empty, after each generate?
Done.
utACK 7e1d6fd43659e7cbfce2efd5433d79ef0fe687ec
(Sorry for sending nits your way a second time, feel free to not fix them; They are mostly not mandatory for the test to function.)
Thanks, LGTM utACK d8c0b9f