Repository navigation
test: add ismine test for descriptor ScriptPubKeyMan - #25942
Conversation
3a3fb68 to
00d89f4
Compare
00d89f4 to
c51a5c0
Compare
furszy
left a comment
There was a problem hiding this comment.
Concept ACK, good catch.
Strange that this wasn't implemented before.
There was a problem hiding this comment.
nit:
BOOST_CHECK(success && parsed_desc);
if (!success) return nullptr;There was a problem hiding this comment.
Done in 1b77db2.
But I changed it to BOOST_CHECK(success == (parsed_desc != nullptr)); since success can be false if Parse function is expected to fail.
There was a problem hiding this comment.
as this shouldn't fail, maybe could inline it:
| auto spk_manager = keystore.AddWalletDescriptor(w_desc, keys, "", false); | |
| BOOST_CHECK(spk_manager != nullptr); | |
| return spk_manager; | |
| return Assert(keystore.AddWalletDescriptor(w_desc, keys,/*label=*/"", /*internal=*/false)); |
c51a5c0 to
de5f82a
Compare
|
#25942 (review) addressed in 1b77db2. Tests for |
de5f82a to
8e3685f
Compare
8e3685f to
1b77db2
Compare
| // (P2PKH inside) P2SH inside P2SH (invalid) - Descriptor | ||
| { | ||
| CWallet keystore(chain.get(), "", m_args, CreateDummyWalletDatabase()); | ||
| std::string desc_str = "sh(sh(" + EncodeSecret(keys[0]) + "))"; | ||
|
|
||
| auto spk_manager = CreateDescriptor(keystore, desc_str, false); | ||
| BOOST_CHECK_EQUAL(spk_manager, nullptr); | ||
| } |
There was a problem hiding this comment.
Is ismine_tests.cpp the right place for this test? It doesn't seem to be testing IsMine. There are a few other places where it seems like IsMine isn't being tested, namely wherever the script is invalid and CreateDescriptor returns a nullptr.
There was a problem hiding this comment.
Right. This happens in the cases below:
- P2PKH inside P2SH inside P2SH (invalid)
- P2PKH inside P2SH inside P2WSH (invalid)
- P2WPKH inside P2WSH (invalid)
- P2PKH inside P2WSH inside P2WSH (invalid)
- P2WPKH uncompressed (invalid)
- P2WSH multisig with uncompressed key (invalid)
These cases cannot be reproduced for descriptor ScriptPubKeyMan, so I added them just for consistency and to make this difference explicit.
I can remove them if the reviewers think this is not necessary.
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsNo conflicts as of last run. |
|
ACK 1b77db2 |
|
ACK 1b77db2 |
Currently
src/wallet/test/ismine_tests.cpphas tests for the legacy ScriptPubKeyMan only.This PR adds tests for the descriptor ScriptPubKeyMan.