Fixing #28057.
The legacy wallet allows to import any raw script (#28126), without checking if it was valid or not. Appending it to the watch-only set.
This causes a crash in the migration process because we are only expecting to find valid scripts inside the legacy spkm.
These stored scripts internally map to ISMINE_NO
(same as if they
weren’t stored at all..).
So we need to check for these special case, and take into account that the legacy spkm could be storing invalid not watched scripts.
Which, in code words, means IsMineInner()
returning
IsMineResult::INVALID
for them.
Note:
To verify this, can run the test commit on top of master.
wallet_migration.py
will crash without the bugfix commit.