mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-18 11:37:40 +02:00
Merge #18918: wallet: Move salvagewallet into wallettool
84ae0578b6Add release notes about salvage changes (Andrew Chow)ea337f2d03Move RecoverKeysOnlyFilter into RecoverDataBaseFile (Andrew Chow)9ea2d258b4Move RecoverDatabaseFile and RecoverKeysOnlyFilter into salvage.{cpp/h} (Andrew Chow)b426c7764dMake BerkeleyBatch::Recover and WalletBatch::RecoverKeysOnlyFilter standalone (Andrew Chow)2741774214Expose a version of ReadKeyValue and use it in RecoverKeysOnlyFilter (Andrew Chow)ced95d0e43Move BerkeleyEnvironment::Salvage into BerkeleyBatch::Recover (Andrew Chow)07250b8dcewalletdb: remove fAggressive from Salvage (Andrew Chow)8ebcbc85c6walletdb: don't automatically salvage when corruption is detected (Andrew Chow)d321046f4bwallet: remove -salvagewallet (Andrew Chow)cdd955e580Add basic test for bitcoin-wallet salvage (Andrew Chow)c87770915bwallettool: Add a salvage command (Andrew Chow) Pull request description: Removes the `-salvagewallet` startup option and adds a `salvage` command to the `bitcoin-wallet` tool. As such, `-salvagewallet` is removed. Additionally, the automatic salvage that is done if the wallet file fails to load is removed. Lastly the salvage code entirely is moved out entirely into `bitcoin-wallet` from `walletdb.{cpp/h}` and `db.{cpp/h}`. ACKs for top commit: jonatack: ACK84ae0578b6feedback taken, and compared to my previous review, the bitcoin-wallet salvage command now seems to run and it exits without raising. The new test passes at both 9454105 and84ae057so as a sanity check I'd agree there is room for improvement, if possible. MarcoFalke: re-ACK84ae0578b6🏉 Empact: Code Review ACK84ae0578b6ryanofsky: Code review ACK84ae0578b6. Lot of small changes since previous review: added verify step before salvage, added basic test in new commit, removed unused scanstate variable and warnings parameter, tweaked various comments and strings, moved fsuccess variable declaration meshcollider: Concept / light code review ACK84ae0578b6Tree-SHA512: 05be116b56ecade1c58faca1728c8fe4b78f0a082dbc2544a3f7507dd155f1f4f39070bd1fe90053444384337bc48b97149df5c1010230d78f8ecc08e69d93af
This commit is contained in:
@@ -203,6 +203,14 @@ class ToolWalletTest(BitcoinTestFramework):
|
||||
assert_equal(shasum_after, shasum_before)
|
||||
self.log.debug('Wallet file shasum unchanged\n')
|
||||
|
||||
def test_salvage(self):
|
||||
# TODO: Check salvage actually salvages and doesn't break things. https://github.com/bitcoin/bitcoin/issues/7463
|
||||
self.log.info('Check salvage')
|
||||
self.start_node(0, ['-wallet=salvage'])
|
||||
self.stop_node(0)
|
||||
|
||||
self.assert_tool_output('', '-wallet=salvage', 'salvage')
|
||||
|
||||
def run_test(self):
|
||||
self.wallet_path = os.path.join(self.nodes[0].datadir, self.chain, 'wallets', 'wallet.dat')
|
||||
self.test_invalid_tool_commands_and_args()
|
||||
@@ -211,7 +219,7 @@ class ToolWalletTest(BitcoinTestFramework):
|
||||
self.test_tool_wallet_info_after_transaction()
|
||||
self.test_tool_wallet_create_on_existing_wallet()
|
||||
self.test_getwalletinfo_on_different_wallet()
|
||||
|
||||
self.test_salvage()
|
||||
|
||||
if __name__ == '__main__':
|
||||
ToolWalletTest().main()
|
||||
|
||||
@@ -404,8 +404,6 @@ class WalletTest(BitcoinTestFramework):
|
||||
'-reindex',
|
||||
'-zapwallettxes=1',
|
||||
'-zapwallettxes=2',
|
||||
# disabled until issue is fixed: https://github.com/bitcoin/bitcoin/issues/7463
|
||||
# '-salvagewallet',
|
||||
]
|
||||
chainlimit = 6
|
||||
for m in maintenance:
|
||||
|
||||
@@ -122,10 +122,6 @@ class MultiWalletTest(BitcoinTestFramework):
|
||||
self.nodes[0].assert_start_raises_init_error(['-zapwallettxes=1', '-wallet=w1', '-wallet=w2'], "Error: -zapwallettxes is only allowed with a single wallet file")
|
||||
self.nodes[0].assert_start_raises_init_error(['-zapwallettxes=2', '-wallet=w1', '-wallet=w2'], "Error: -zapwallettxes is only allowed with a single wallet file")
|
||||
|
||||
self.log.info("Do not allow -salvagewallet with multiwallet")
|
||||
self.nodes[0].assert_start_raises_init_error(['-salvagewallet', '-wallet=w1', '-wallet=w2'], "Error: -salvagewallet is only allowed with a single wallet file")
|
||||
self.nodes[0].assert_start_raises_init_error(['-salvagewallet=1', '-wallet=w1', '-wallet=w2'], "Error: -salvagewallet is only allowed with a single wallet file")
|
||||
|
||||
# if wallets/ doesn't exist, datadir should be the default wallet dir
|
||||
wallet_dir2 = data_dir('walletdir')
|
||||
os.rename(wallet_dir(), wallet_dir2)
|
||||
|
||||
Reference in New Issue
Block a user