Commit graph

49 commits

Author SHA1 Message Date
MarcoFalke
fa8b9b5d1f
test: Fix intermittent failure in wallet_importmulti 2020-04-23 19:01:26 -04:00
Jon Atack
dc0cabeda4
test: remove getaddressinfo label tests 2020-01-09 17:30:58 +01:00
Jon Atack
60aba1f2f1
rpc: simplify getaddressinfo labels, deprecate previous behavior
- change the value returned in the RPC getaddressinfo `labels` field to an array
  of label name strings

- deprecate the previous behavior of returning a JSON hash structure containing
  label `name` and address `purpose` key/value pairs

- update the relevant tests
2020-01-03 19:46:20 +01:00
Jon Atack
33f5fc32e5
test: add rpc getaddressinfo labels test coverage 2019-11-24 23:08:38 +01:00
Andrew Chow
b84e776fd1 wallet_importmulti: use addresses of the same type as being imported
When constructing an import from the solving data of an address,
make sure that the original address is the same type as the one that
will be imported.
2019-11-05 18:31:10 -05:00
practicalswift
25dd867150 Avoid using mutable default parameter values 2019-08-26 10:45:25 +00:00
Andrew Chow
625534d7b1 Give more errors for specific failure conditions
Some failure conditions implicitly fail by failing some other check.
But the error messages are more helpful if they say explicitly what
actually caused the failure, so add those as failure conditions and
errors.
2019-08-16 19:34:01 -04:00
Andrew Chow
c325f619dd Return an error from descriptor Parse that gives more information about what failed 2019-08-16 19:34:01 -04:00
MeshCollider
53b7de629d Add test for dumping the private key imported from descriptor 2019-06-08 01:34:58 +12:00
MeshCollider
2857bc4a64 Extend importmulti descriptor tests 2019-06-07 21:14:55 +12:00
MeshCollider
81a884bbd0 Import private keys from descriptor with importmulti if provided 2019-06-06 22:03:55 +12:00
MarcoFalke
14959753a4
Merge #15744: refactor: Extract ParseDescriptorRange
510c6532ba Extract ParseDescriptorRange (Ben Woosley)

Pull request description:

  So as to be consistently informative when the checks fail, and
  to protect against unintentional divergence among the checks.

ACKs for commit 510c65:
  meshcollider:
    Oh apologies, yes. Thanks :) utACK 510c6532ba
  MarcoFalke:
    utACK 510c6532ba
  sipa:
    utACK 510c6532ba

Tree-SHA512: b1f0792bfaa163890a20654a0fc2c4c4a996659916bf5f4a495662436b39326692a1a0c825caafd859e48c05f5dd1865c4f7c28092be5074edda3c94f94f9f8b
2019-05-10 08:09:44 -04:00
Ben Woosley
510c6532ba
Extract ParseDescriptorRange
So as to be consistently informative when the checks fail, and
to protect against unintentional divergence among the checks.
2019-04-13 18:52:11 -07:00
MarcoFalke
5392aee64f
Merge #15629: init: Throw error when network specific config is ignored
fae38c3dc6 doc: Fix all typos reported by codespell (MarcoFalke)
fa9058f0ed doc: Add release notes for 15629 (MarcoFalke)
fa4a922d78 qa: Add test for missing testnet section in conf file (MarcoFalke)
dddd6f0f58 init: Throw error when network specific config is ignored (MarcoFalke)

Pull request description:

  This should have no effect on mainnet users, but simplifies testing, where config settings are currently ignored with only a warning. Fix this by making it an error.

  Issues:
  *  bitcoin client 0.17.0 ignores wallet's name (file) #14523
  *  Can't set custom rpcport on testnet #13777
  * ...

ACKs for commit fae38c:

Tree-SHA512: 2e209526898eea6e444c803ec2666989cee4ca137492d32984998733c50a70056cb54657df8dc3027a6a0612738a8afce0bc35824b868c5f22281e00e0188530
2019-04-09 21:14:49 -04:00
Pieter Wuille
b5d3987724 Take non-importing keys into account for spendability warning in descriptor import 2019-04-06 09:14:56 -07:00
MarcoFalke
fae38c3dc6
doc: Fix all typos reported by codespell 2019-03-22 13:19:44 -04:00
MarcoFalke
faa7cdf764
scripted-diff: Update copyright in ./test
-BEGIN VERIFY SCRIPT-
./contrib/devtools/copyright_header.py update ./test/
-END VERIFY SCRIPT-
2019-03-02 10:58:35 -05:00
MarcoFalke
fa6bf21f5e
scripted-diff: test: Use py3.5 bytes::hex() method
-BEGIN VERIFY SCRIPT-
sed -i -e "s/def bytes_to_hex_str/def b_2_x/g" $(git grep -l bytes_to_hex_str)

export RE_B_0="[^()]*"                          # match no bracket
export RE_B_1="${RE_B_0}\(${RE_B_0}\)${RE_B_0}" # match exactly one ()
export RE_B_2="${RE_B_0}\(${RE_B_1}\)${RE_B_0}" # match wrapped (())

export RE_M="(b2x|bytes_to_hex_str)\(((${RE_B_0}|${RE_B_1}|${RE_B_2})*)\)"

sed -i --regexp-extended -e "s/${RE_M}/\2.hex()/g"      $(git grep -l -E '(b2x|bytes_to_hex_str)')

sed -i --regexp-extended -e "/  +bytes_to_hex_str( as b2x)?,/d"    $(git grep -l bytes_to_hex_str)
sed -i --regexp-extended -e "s/ +bytes_to_hex_str( as b2x)?,//g"   $(git grep -l bytes_to_hex_str)
sed -i --regexp-extended -e "s/, bytes_to_hex_str( as b2x)?//g"    $(git grep -l bytes_to_hex_str)

export RE_M="(binascii\.)?hexlify\(((${RE_B_0}|${RE_B_1}|${RE_B_2})*)\).decode\(${RE_B_0}\)"

sed -i --regexp-extended -e "s/${RE_M}/\2.hex()/g" $(git grep -l hexlify -- ':(exclude)share')

sed -i --regexp-extended -e  "/from binascii import hexlify$/d" $(git grep -l hexlify -- ':(exclude)share')
sed -i --regexp-extended -e "s/(from binascii import) .*hexlify/\1 unhexlify/g" $(git grep -l hexlify -- ':(exclude)share')

sed -i -e 's/ignore-names "/ignore-names "b_2_x,/g' ./test/lint/lint-python-dead-code.sh
-END VERIFY SCRIPT-
2019-03-02 10:40:12 -05:00
Pieter Wuille
1675b7ce55 Use stop/[start,stop] notation in importmulti desc range 2019-02-28 13:05:10 -08:00
Pieter Wuille
be62903c41 Make descriptor checksums mandatory in deriveaddresses and importmulti 2019-02-15 22:36:05 -08:00
Andrew Chow
f4b00b70e8 Import public keys in order
Do public key imports in the order that they are specified in the import
or in the descriptor range.
2019-02-14 18:34:03 -05:00
Andrew Chow
9e1551b9ce Test pubkey import to keypool 2019-02-14 18:33:29 -05:00
Andrew Chow
4c75a69f36 Test importing descriptors with key origin information 2019-02-14 17:58:25 -05:00
MeshCollider
fbb5e935ea Add test for importing via descriptor 2019-02-05 19:42:05 +13:00
John Newbery
2d5f1ea2e3 [tests] move wallet util functions to wallet_util.py
Adds a new wallet_util.py module and moves generic helper functions
there:

- get_key
- get_multisig
- test_address
2019-01-04 17:49:17 -08:00
John Newbery
6be64ef02c [tests] tidy up wallet_importmulti.py
Fixes review comments from PR 14886.
2019-01-04 17:46:33 -08:00
Pieter Wuille
bdacbda253 Overhaul importmulti logic
This introduces various changes to the importmulti logic:
* Instead of processing input and importing things at the same time, first
  process all input data and verify it, so no changes are made in case of
  an error.
* Verify that no superfluous information is provided (no keys or scripts
  that don't contribute to solvability in particular).
* Add way more sanity checks, by means of descending into all involved
  scripts.
2018-12-12 16:32:33 -08:00
John Newbery
ee3b21dccb [tests] Add docstring for wallet_importmulti.py
Adds a docstring describing the new importmulti test.
2018-12-10 15:35:38 -05:00
John Newbery
fbdba40594 [tests] add test_address method to wallet_import.py
Adds a new test_address method for testing the
imported addresses.
2018-12-10 15:35:36 -05:00
John Newbery
fd3a02c381 [tests] add test_importmulti method to wallet_import.py
Adds a new test_importmulti method for testing the
importmulti RPC method.
2018-12-10 15:19:08 -05:00
John Newbery
08a4a0f70f [tests] add get_multisig function to wallet_importmulti.py
Adds a new get_multisig function which generates
a new multisig and returns the public keys,
private keys and all script and address types.
2018-12-10 15:17:28 -05:00
John Newbery
7c99614b40 [tests] add get_key function to wallet_importmulti.py
Adds a new get_key function which generates
a new key and returns the public key,
private key and all script and address types.
2018-12-10 15:17:26 -05:00
John Newbery
e5a8ea8f14 [tests] tidy up imports in wallet_importmulti.py 2018-12-06 12:18:52 -05:00
John Newbery
cb41ade6b1 [tests] fix flake8 warnings in wallet_importmulti.py 2018-12-06 12:18:52 -05:00
MarcoFalke
8c59bb85f9
Merge #14720: rpc: Correctly name arguments
fa0815c300 rpc: Correctly name arguments (Jon Layton)

Pull request description:

  Consistently use the same name to describe arguments in the documentation and add a test that uses the name.

  By splitting it up, the changes are easier to potentially backport and also make review easier when we switch to `RPCHelpMan`.

  The tests should pass with or without the changes in `src`.

  Partly stolen from #14459 (More RPC help description fixes by ch4ot1c)

Tree-SHA512: 1072992b1e93ac41006613523e54a0a8004f529fcb101eb9d74d91474abb0945a5a7539f249905151b904b87448f9efc0cacbd9e052fbe2ea9111e62f3e7249c
2018-11-13 16:49:23 -05:00
Jon Layton
fa0815c300
rpc: Correctly name arguments 2018-11-13 14:24:40 -05:00
Gregory Sanders
7afddfa8ce importmulti: Don't add internal addresses to address book 2018-11-07 14:43:14 -05:00
MeshCollider
c11875c590 Add segwit address tests for importmulti 2018-10-25 09:30:57 +13:00
MeshCollider
f6ed748cf0 Add SegWit support to importmulti with some ProcessImport cleanup 2018-10-25 09:30:56 +13:00
Wladimir J. van der Laan
288ddf4ff5
Merge #14180: qa: Run all tests even if wallet is not compiled
fac9539836 qa: Run all tests even if wallet is not compiled (MarcoFalke)
faa669cbcd qa: Premine to deterministic address with -disablewallet (MarcoFalke)

Pull request description:

  Currently the test_runner would exit if the wallet was not compiled into the Bitcoin Core executable. However, a lot of the tests run without the wallet just fine and there is no need to globally require the wallet to run the tests.

Tree-SHA512: 63177260aa29126fd20f0be217a82b10b62288ab846f96f1cbcc3bd2c52702437703475d91eae3f8d821a3149fc62b725a4c5b2a7b3657b67ffcbc81532a03bb
2018-09-13 13:06:07 +02:00
MarcoFalke
fac9539836
qa: Run all tests even if wallet is not compiled 2018-09-10 17:53:21 -04:00
MarcoFalke
fa263bcfe4
qa: Fix silent merge conflict in wallet_importmulti 2018-09-10 13:08:06 -04:00
Wladimir J. van der Laan
13c842e028
Merge #9332: Let wallet importmulti RPC accept labels for standard scriptPubKeys
98ea64cf23 Let wallet importmulti RPC accept labels for standard scriptPubKeys (Russell Yanofsky)

Pull request description:

  Allow importmulti RPC to apply address labels when importing standard scriptPubKeys. This makes the importmulti RPC less finnicky about import formats and also simpler internally.

Tree-SHA512: 102426b21239f1fa5f38162dc3f4145572caef76e63906afd786b7aff1670d6cd93456f8d85f737588eedc49c11bef2e1e8019b8b2cbf6097c77b3501b0cab1f
2018-09-10 19:02:44 +02:00
practicalswift
68400d8b96 tests: Use explicit imports 2018-08-13 14:13:39 +02:00
DrahtBot
eb7daf4d60 Update copyright headers to 2018 2018-07-27 07:15:02 -04:00
practicalswift
169f3e8637 Remove assigned but never used local variables 2018-03-29 17:47:12 +02:00
Russell Yanofsky
98ea64cf23 Let wallet importmulti RPC accept labels for standard scriptPubKeys
Allow importmulti RPC to apply address labels when importing standard
scriptPubKeys. This makes the importmulti RPC less finnicky about import
formats and also simpler internally.
2018-02-22 10:04:42 -05:00
Andrew Chow
b22cce0148 scripted-diff: validateaddress to getaddressinfo in tests
Change all instances of validateaddress to getaddressinfo since it seems that
no test actually uses validateaddress for actually validating addresses.

-BEGIN VERIFY SCRIPT-
find ./test/functional -path '*py' -not -path ./test/functional/wallet_disable.py -not -path ./test/functional/rpc_deprecated.py -not -path ./test/functional/wallet_address_types.py -exec sed -i'' -e 's/validateaddress/getaddressinfo/g' {} \;
-END VERIFY SCRIPT-
2018-02-16 12:09:36 -05:00
Anthony Towns
90600bc7db [tests] Rename wallet_* functional tests. 2018-01-25 09:44:29 +10:00
Renamed from test/functional/importmulti.py (Browse further)