The legacy wallet IsMine
code will be removed with the legacy wallet, but is still partially needed for migration. Instead of using IsMine
directly in migration, equivalent checks are performed by migration.
Builds on #26596
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
For detailed information about the code coverage, see the test coverage report.
See the guideline for information on the review process.
Type | Reviewers |
---|---|
Concept ACK | theStack |
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
No conflicts as of last run.
1725- // Add ScriptHash for scripts that are not already P2SH
1726- if (!script.IsPayToScriptHash()) {
1727+ std::vector<std::vector<unsigned char>> sols;
1728+ TxoutType type = Solver(script, sols);
1729+ switch (type) {
1730+ // We don't care aboue these types because they are not spendable
0 // We don't care about these types because they are not spendable
1868+ return true;
1869+ }
1870+ case TxoutType::MULTISIG:
1871+ {
1872+ if (ctx == ScriptContext::P2WSH) {
1873+ std::vector<valtype> keys(sols.begin() + 1, sols.begin() + sols.size() - 1);
CPubKey
then use IsCompressed
?
1720@@ -1721,37 +1721,157 @@ std::unordered_set<CScript, SaltedSipHasher> LegacyDataSPKM::GetScriptPubKeys()
1721 // For all keys, if they have segwit scripts, those scripts will end up in mapScripts
1722 for (const auto& script_pair : mapScripts) {
1723 const CScript& script = script_pair.second;
1724- if (IsMine(script) == ISMINE_SPENDABLE) {
In 905e22b469a1e09df9ff0e98bf989a55642f301e “wallet: Remove IsMine from migration”: Maybe it’s worth updating the documentation?
0// For every script in mapScript, only the ISMINE_SPENDABLE ones are being tracked.
🚧 At least one of the CI tasks failed. Debug: https://github.com/bitcoin/bitcoin/runs/27341718423
Make sure to run all tests locally, according to the documentation.
The failure may happen due to a number of reasons, for example:
Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.
A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.
An intermittent issue.
Leave a comment here, if you need help tracking down a confusing failure.
1802+ const CScript& script = script_pair.second;
1803+ std::vector<std::vector<unsigned char>> sols;
1804+ TxoutType type = Solver(script, sols);
1805+ if (type == TxoutType::WITNESS_V0_SCRIPTHASH) {
1806+ uint160 hash;
1807+ CRIPEMD160().Write(sols[0].data(), sols[0].size()).Finalize(hash.begin());
nit: can use the RIPEMD160
helper here
0 uint160 hash{RIPEMD160(sols[0])};
1786+ if (key.size() != 33) {
1787+ allowed = false;
1788+ break;
1789+ }
1790+ }
1791+ if (allowed) {
nit: to deduplicate code, could introduce an all_keys_compressed
helper that is used here and below in the is_valid_script
lambda, e.g. something like:
0 const auto& all_keys_compressed = [](const std::vector<valtype>& keys) -> bool {
1 return std::all_of(keys.cbegin(), keys.cend(),
2 [](const auto& key) { return key.size() == 33; });
3 };
Commit message in d5d994c02bb54db395da457724ec45539f1c10a8 incorrectly states: “This reverts commit bbb1d51e1240da61db2ca1036f9ec91fd2f36f2d.”
I believe that commit ended up being merged as b231f4d556876ae70305e8710e31d53525ded8ae.
🚧 At least one of the CI tasks failed. Debug: https://github.com/bitcoin/bitcoin/runs/27341718760
Make sure to run all tests locally, according to the documentation.
The failure may happen due to a number of reasons, for example:
Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.
A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.
An intermittent issue.
Leave a comment here, if you need help tracking down a confusing failure.
As IsMine will be removed, the relevant components of IsMine are inlined
into the migration functions.
This reverts commit bbb1d51e1240da61db2ca1036f9ec91fd2f36f2d.
#30328#pullrequestreview-2201704324 still applies to 705d9eb0aef8831891e1cce80c33615440547e90 instead of d5d994c02bb54db395da457724ec45539f1c10a8.
(Clarified linked comment a bit).