aboutsummaryrefslogtreecommitdiff
path: root/test/functional/wallet_crosschain.py
AgeCommit message (Collapse)Author
2023-10-10 test: Use pathlib over os.path #28362ns-xvrn
revert netutil chgs py3.8 compliant fixes based on PR review
2023-01-28test: refactor: introduce `replace_in_config` helperSebastian Falbesoner
2023-01-04Merge bitcoin/bitcoin#26747: wallet: fix confusing error / GUI crash on ↵Andrew Chow
cross-chain legacy wallet restore 21ad4e26ec320dcecc8961888bc82d0bb72d5ed3 test: add coverage for cross-chain wallet restore (Sebastian Falbesoner) 8c7222bda3f7136f312a6e57b76d6a2d0a114f68 wallet: fix GUI crash on cross-chain legacy wallet restore (Sebastian Falbesoner) Pull request description: Restoring a wallet backup from another chain should result in a dedicated error message (we have _"Wallet files should not be reused across chains. Restart bitcoind with -walletcrosschain to override."_ for that). Unfortunately this is currently not the case for legacy wallet restores, as in the course of cleaning up the newly created wallet directory a `filesystem_error` exception is thrown due to the directory not being empty; the wallet database did indeed load successfully (otherwise we wouldn't know that the chain doesn't match) and hence BDB-related files and directories are already created in the wallet directory. For bitcoind, this leads to a very confusing error message: ``` $ ./src/bitcoin-cli restorewallet test123 ~/.bitcoin/regtest/wallets/regtest_wallet/wallet.dat error code: -1 error message: filesystem error: in remove: Directory not empty ["/home/thestack/.bitcoin/wallets/test123"] ``` Even worse, the GUI crashes in such a scenario: ``` libc++abi: terminating with uncaught exception of type std::__1::__fs::filesystem::filesystem_error: filesystem error: in remove: Directory not empty ["/home/thestack/.bitcoin/wallets/foobar"] Abort trap (core dumped) ``` Fix this by simply deleting the whole folder via `fs::remove_all`. With this, the expected error message appears both for the `restorewallet` RPC call and in the GUI (as a message-box): ``` $ ./src/bitcoin-cli restorewallet test123 ~/.bitcoin/regtest/wallets/regtest_wallet/wallet.dat error code: -4 error message: Wallet loading failed. Wallet files should not be reused across chains. Restart bitcoind with -walletcrosschain to override. ``` ACKs for top commit: achow101: ACK 21ad4e26ec320dcecc8961888bc82d0bb72d5ed3 aureleoules: ACK 21ad4e26ec320dcecc8961888bc82d0bb72d5ed3 furszy: utACK 21ad4e26 Tree-SHA512: 313f6494c2fbe823bff9b975cb2d9410bb518977a1e59a5159ee9836bc012947fa50b56be0e41b1a2f50d9c0c7f4fddfdf4fbe479d8a59a6ee44bb389c804abc
2023-01-04test: add coverage for cross-chain wallet restoreSebastian Falbesoner
2022-12-24scripted-diff: Bump copyright headersHennadii Stepanov
-BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT- Commits of previous years: - 2021: f47dda2c58b5d8d623e0e7ff4e74bc352dfa83d7 - 2020: fa0074e2d82928016a43ca408717154a1c70a4db - 2019: aaaaad6ac95b402fe18d019d67897ced6b316ee0
2022-11-28Merge bitcoin/bitcoin#26480: test: Remove wallet option from non-wallet testsAndrew Chow
fa10f193b54650b3071bc7ee2d90fcfe40a16dc9 test: Set default in add_wallet_options if only one type can be chosen (MacroFake) 555519d082fbe5e047595f06d7f301e441bb7149 test: Remove wallet option from non-wallet tests (MacroFake) fac8d59d310fa94a8d5dd99659a76cd958d1fd1b test: Set -disablewallet when no wallet has been compiled (MacroFake) fa68937b89aa5b10b33b3f5146390cd7ad369ff7 test: Make requires_wallet private (MacroFake) Pull request description: The tests have several issues: * Some tests that are wallet-type specific offer the option to run the test with the incompatible type For example, `wallet_dump.py` offers `--descriptors` and on current master fails with `JSONRPCException: Invalid public key`. After the changes here, it fails with a clear error: `unrecognized arguments: --descriptors`. * Tests that don't use the wallet at all offer the option to run it with a wallet type. This is confusing and wastes developers time if they are "tricked" into running the test for both wallet types, even though no wallet code is executed at all. For example, `feature_addrman.py` will happily accept and run with `--descriptors` or `--legacy-wallet`. After the changes here, it no longer silently ignores the flag, but reports a clear error: `unrecognized arguments`. ACKs for top commit: achow101: ACK fa10f193b54650b3071bc7ee2d90fcfe40a16dc9 Tree-SHA512: a5784da7305f4ec58c0013f433289000d94fc3d434b00fc329ffa37b812e2cd1da0071e34c3462bf79d904808564f2ae6d3d582f6b86b26215f9b07391b58460
2022-11-10test: Remove wallet option from non-wallet testsMacroFake
Review note: The changes are complete, because self.options.descriptors is set to None in parse_args (test_framework.py). A value of None implies -disablewallet, see the previous commit. So if a call to add_wallet_options is missing, it will lead to a test failure when the wallet is compiled in.
2022-10-10Add warning on first startup if free disk space is less than necessaryBen Woosley
To accommodate the expected blocks data. Co-authored-by: Antoine Poinsot <darosior@protonmail.com> Co-authored-by: benthecarman <benthecarman@live.com> Co-authored-by: Justin Litchfield <litch@me.com> Co-authored-by: Liran Cohen <c.liran.c@gmail.com> Co-authored-by: Ryan Loomba <ryan.loomba@gmail.com> Co-authored-by: Buck Perley <bucko.perley@gmail.com> Co-authored-by: bajjer <bajjer@bajjer.xyz> Co-authored-by: Suhail Saqan <suhail.saqan@gmail.com> Co-authored-by: Christopher Sweeney <sweeney.chris@gmail.com> Co-authored-by: Alyssa <orbitalturtle@protonmail.com> Co-authored-by: Ben Schroth <ben@styng.social> Co-authored-by: Jason Hester <mail@jason-hester.me> Co-authored-by: Matt Clough <Matt.clough@pm.me> Co-authored-by: Elise Schedler <eliseschedler@gmail.com> Co-authored-by: ghander <cen254@gmail.com> Co-authored-by: PopeLaz <btclz@fastmail.com> Co-authored-by: Aurèle Oulès <hello@aureleoules.com>
2022-02-16tests: add tests for cross-chain wallet use preventionSeibart Nedor