mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-16 16:32:47 +00:00
wallet: Always rewrite tx records during migration
Since loading a wallet may change some parts of tx records (e.g. adding nOrderPos), we should rewrite the records instead of copying them so that the automatic upgrade does not need to be performed again when the wallet is loaded.
This commit is contained in:
parent
184159e4f3
commit
af041c4057
@ -3947,14 +3947,16 @@ util::Result<void> CWallet::ApplyMigrationData(WalletBatch& local_wallet_batch,
|
||||
// Mark as to remove from the migrated wallet only if it does not also belong to it
|
||||
if (!is_mine) {
|
||||
txids_to_delete.push_back(hash);
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!is_mine) {
|
||||
// Both not ours and not in the watchonly wallet
|
||||
return util::Error{strprintf(_("Error: Transaction %s in wallet cannot be identified to belong to migrated wallets"), wtx->GetHash().GetHex())};
|
||||
}
|
||||
// Rewrite the transaction so that anything that may have changed about it in memory also persists to disk
|
||||
local_wallet_batch.WriteTx(*wtx);
|
||||
}
|
||||
|
||||
// Do the removes
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user