mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 06:58:57 +01:00
Merge bitcoin/bitcoin#28609: wallet: Reload watchonly and solvables wallets after migration
4814e4063etest: Check tx metadata is migrated to watchonly (Andrew Chow)d616d30ea5wallet: Reload watchonly and solvables wallets after migration (Andrew Chow)118f2d7d70wallet: Copy all tx metadata to watchonly wallet (Andrew Chow)9af87cf348test: Check that a failed wallet migration is cleaned up (Andrew Chow) Pull request description: Some incomplete/incorrect state as a result of migration can be mitigated/cleaned up by simply restarting the migrated wallets. We already do this for a wallet when it is migrated, but we do not for the new watchonly and solvables wallets that may be created. This PR introduces this behavior, in addition to creating those wallets initially without an attached chain. While implementing this, I noticed that not all `CWalletTx` metadata was being copied over to the watchonly wallet and so some data, such as time received, was being lost. This PR fixes this as a side effect of not having a chain attached to the watchonly wallet. A test has also been added. ACKs for top commit: ishaanam: light code review ACK4814e4063eryanofsky: Code review ACK4814e4063e. Just implemented the suggested orderpos, copyfrom, and path set comments since last review furszy: ACK4814e406Tree-SHA512: 0b992430df9f452cb252c2212df8e876613f43564fcd1dc00c6c31fa497adb84dfff6b5ef597590f9b288c5f64cb455f108fcc9b6c9d1fe9eb2c39e7f2c12a89
This commit is contained in:
@@ -334,11 +334,15 @@ public:
|
||||
const uint256& GetWitnessHash() const { return tx->GetWitnessHash(); }
|
||||
bool IsCoinBase() const { return tx->IsCoinBase(); }
|
||||
|
||||
private:
|
||||
// Disable copying of CWalletTx objects to prevent bugs where instances get
|
||||
// copied in and out of the mapWallet map, and fields are updated in the
|
||||
// wrong copy.
|
||||
CWalletTx(CWalletTx const &) = delete;
|
||||
void operator=(CWalletTx const &x) = delete;
|
||||
CWalletTx(const CWalletTx&) = default;
|
||||
CWalletTx& operator=(const CWalletTx&) = default;
|
||||
public:
|
||||
// Instead have an explicit copy function
|
||||
void CopyFrom(const CWalletTx&);
|
||||
};
|
||||
|
||||
struct WalletTxOrderComparator {
|
||||
|
||||
Reference in New Issue
Block a user