[qa] Add test for rescan feature of wallet key import RPCs #9331

pull ryanofsky wants to merge 1 commits into bitcoin:master from ryanofsky:pr/test-import-rescan changing 2 files +156 −0
  1. ryanofsky commented at 3:48 pm on December 12, 2016: member

    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.

  2. [qa] Add test for rescan feature of wallet key import RPCs
    Covers importaddress, importpubkey, importprivkey, and importmulti RPCs.
    d8c0b9f525
  3. fanquake added the label Tests on Dec 13, 2016
  4. in qa/rpc-tests/import-rescan.py: in 6bbbe2c52f outdated
    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 *
    


    MarcoFalke commented at 10:20 am on December 13, 2016:
    nit: no wildcard import here.

    ryanofsky commented at 12:29 pm on December 13, 2016:
    Removed
  5. MarcoFalke commented at 10:27 am on December 13, 2016: member
    Concept ACK
  6. ryanofsky force-pushed on Dec 13, 2016
  7. in qa/rpc-tests/import-rescan.py: in 7e1d6fd436 outdated
    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)
    


    MarcoFalke commented at 12:43 pm on December 15, 2016:
    0from decimal import Decimal
    

    would be cleaner


    ryanofsky commented at 3:28 pm on December 15, 2016:
    Fixed.
  8. in qa/rpc-tests/import-rescan.py: in 7e1d6fd436 outdated
    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))
    


    MarcoFalke commented at 1:48 pm on December 15, 2016:
    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.

    ryanofsky commented at 3:28 pm on December 15, 2016:
    Thanks, I was just using yapf, but I increased the column width.
  9. in qa/rpc-tests/import-rescan.py: in 7e1d6fd436 outdated
    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"]
    


    MarcoFalke commented at 1:50 pm on December 15, 2016:
    This probably does not change during the loop, so maybe cache it?

    ryanofsky commented at 3:28 pm on December 15, 2016:
    Done.
  10. in qa/rpc-tests/import-rescan.py: in 7e1d6fd436 outdated
    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)
    


    MarcoFalke commented at 1:53 pm on December 15, 2016:
    Assert that the transaction pool is empty, after each generate?

    ryanofsky commented at 3:28 pm on December 15, 2016:
    Done.
  11. MarcoFalke approved
  12. MarcoFalke commented at 2:08 pm on December 15, 2016: member

    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.)

  13. ryanofsky force-pushed on Dec 15, 2016
  14. laanwj commented at 4:05 pm on December 15, 2016: member
    Thanks, LGTM utACK d8c0b9f
  15. laanwj merged this on Dec 15, 2016
  16. laanwj closed this on Dec 15, 2016

  17. laanwj referenced this in commit c6fd923886 on Dec 15, 2016
  18. codablock referenced this in commit bf3cc9ff90 on Jan 18, 2018
  19. andvgal referenced this in commit d807b1283e on Jan 6, 2019
  20. CryptoCentric referenced this in commit 04fda4b670 on Feb 26, 2019
  21. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-10-06 19:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me