Backport #14453 to 0.17
0.17: Backport #14453 #14880
pull promag wants to merge 2 commits into bitcoin:0.17 from promag:2018-12-backport-14453 changing 2 files +21 −8-
promag commented at 11:21 PM on December 5, 2018: member
-
75b5d8c4ea
rpc: Fix wallet unload during walletpassphrase timeout
Github-Pull: #14453 Rebased-From: 321decf
- fanquake added the label Backport on Dec 5, 2018
- fanquake added this to the milestone 0.17.1 on Dec 5, 2018
-
in src/wallet/rpcwallet.cpp:2622 in 31e657b4f2 outdated
2614 | @@ -2622,7 +2615,18 @@ static UniValue walletpassphrase(const JSONRPCRequest& request) 2615 | pwallet->TopUpKeyPool(); 2616 | 2617 | pwallet->nRelockTime = GetTime() + nSleepTime; 2618 | - RPCRunLater(strprintf("lockwallet(%s)", pwallet->GetName()), std::bind(LockWallet, pwallet), nSleepTime); 2619 | + 2620 | + // Keep a weak pointer to the wallet so that it is possible to unload the 2621 | + // wallet before the following callback is called. If a valid shared pointer 2622 | + // is acquired in the callback then the wallet is still loaded. 2623 | + std::weak_ptr<CWallet> weak_wallet = wallet;
Empact commented at 9:15 AM on December 6, 2018:nit: seems construction would be marginally better https://en.cppreference.com/w/cpp/memory/weak_ptr/weak_ptr https://en.cppreference.com/w/cpp/memory/weak_ptr/operator%3D
laanwj commented at 10:53 AM on December 6, 2018:I don't think this is an appropriate comment for a backport as this change exists literally in the commit for master: https://github.com/bitcoin/bitcoin/pull/14453/commits/321decffa1fbf213462d97e5372bd0c4eeb99635
dcb032dcdfqa: Ensure wallet unload during walletpassphrase timeout
0.17 branch doesn't include #12493 which changed encryptwallet behavior. For that reason the test is adjusted. Github-Pull: #14453 Rebased-From: 8907df9
promag force-pushed on Dec 6, 2018laanwj commented at 2:23 PM on December 6, 2018: memberutACK dcb032dcdf8e8300a84ae8ec6cfde0da5381f56f
MarcoFalke commented at 6:06 PM on December 6, 2018: memberutACK dcb032dcdf8e8300a84ae8ec6cfde0da5381f56f
MarcoFalke merged this on Dec 6, 2018MarcoFalke closed this on Dec 6, 2018MarcoFalke referenced this in commit abae8aeff1 on Dec 6, 2018MarcoFalke locked this on Sep 8, 2021ContributorsLabelsMilestone
0.17.1
github-metadata-mirror
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:15 UTC
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-13 15:15 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me
More mirrored repositories can be found on mirror.b10c.me