Page MenuHomePhabricator

[electrum] fix storage.requires_upgrade and test it
ClosedPublic

Authored by PiRK on Jul 6 2023, 14:37.

Details

Reviewers
bytesofman
Group Reviewers
Restricted Project
Commits
rABCdb032ca6cbf6: [electrum] fix storage.requires_upgrade and test it
Summary

WalletStorage.requires_upgrade always returned None, which is False. This is clearly a bug introduced when splitting the WalletStorage and JsonDB classes.

Fix it and test it.

This is currently used in the code to guard against loading (and potentially corrupting) old wallets that are not updated to the current format. But this should not happen except in the tests (when manual_upgrades=True is passed to the constructor), as the upgrade is done automatically when initializing a JsonDB class.

Test Plan

ninja check-electrum

This fails with this test fix and without the code fix.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Jul 6 2023, 14:37

also add typehints so that mypy and pycharm can warn about the issue the next time it happens

This revision is now accepted and ready to land.Jul 6 2023, 15:58

python test_runner.py checks out