Skip to content

Commit d5931f3

Browse files
author
MarcoFalke
committed
Merge #15870: wallet: Only fail rescan when blocks have actually been pruned
fa7e311 [doc] rpcwallet: Only fail rescan when blocks have been pruned (MarcoFalke) aaaa57c scripted-diff: Bump copyright headers in wallet (MarcoFalke) faf3729 wallet: Only fail rescan when blocks have actually been pruned (MarcoFalke) Pull request description: This brings the behaviour of the import* calls closer to importmulti. After this change, the difference between importmulti and the other import* calls is * that in importmulti you can "opt-out" of scanning early blocks by setting a later timestamp. * that in importmulti the wallet will successfully import the data, but fail to rescan. Whereas in the other calls, the wallet will abort before importing the data. ACKs for commit fa7e31: promag: utACK fa7e311. jnewbery: utACK fa7e311 Tree-SHA512: a57d52ffea94b64e0eb9b5d3a7a63031325833908297dd14eb0c5251ffea3b2113b131003f1db4e9599e014369165a57f107a7150bb65e4c791e5fe742f33cb8
2 parents 41f4c63 + fa7e311 commit d5931f3

31 files changed

+79
-61
lines changed

doc/release-notes.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,16 @@ Configuration
111111
the selected network. This change takes only effect if the selected network
112112
is not mainnet.
113113

114+
Wallet
115+
------
116+
117+
- When in pruned mode, a rescan that was triggered by an `importwallet`,
118+
`importpubkey`, `importaddress`, or `importprivkey` RPC will only fail when
119+
blocks have been pruned. Previously it would fail when `-prune` has been set.
120+
This change allows to set `-prune` to a high value (e.g. the disk size) and
121+
the calls to any of the import RPCs would fail when the first block is
122+
pruned.
123+
114124
Credits
115125
=======
116126

src/interfaces/chain.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2018 The Bitcoin Core developers
1+
// Copyright (c) 2018-2019 The Bitcoin Core developers
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

@@ -332,7 +332,11 @@ class ChainImpl : public Chain
332332
CFeeRate relayMinFee() override { return ::minRelayTxFee; }
333333
CFeeRate relayIncrementalFee() override { return ::incrementalRelayFee; }
334334
CFeeRate relayDustFee() override { return ::dustRelayFee; }
335-
bool getPruneMode() override { return ::fPruneMode; }
335+
bool havePruned() override
336+
{
337+
LOCK(cs_main);
338+
return ::fHavePruned;
339+
}
336340
bool p2pEnabled() override { return g_connman != nullptr; }
337341
bool isReadyToBroadcast() override { return !::fImporting && !::fReindex && !IsInitialBlockDownload(); }
338342
bool isInitialBlockDownload() override { return IsInitialBlockDownload(); }

src/interfaces/chain.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2018 The Bitcoin Core developers
1+
// Copyright (c) 2018-2019 The Bitcoin Core developers
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

@@ -196,8 +196,8 @@ class Chain
196196
//! Relay dust fee setting (-dustrelayfee), reflecting lowest rate it's economical to spend.
197197
virtual CFeeRate relayDustFee() = 0;
198198

199-
//! Check if pruning is enabled.
200-
virtual bool getPruneMode() = 0;
199+
//! Check if any block has been pruned.
200+
virtual bool havePruned() = 0;
201201

202202
//! Check if p2p enabled.
203203
virtual bool p2pEnabled() = 0;

src/wallet/coincontrol.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2011-2018 The Bitcoin Core developers
1+
// Copyright (c) 2011-2019 The Bitcoin Core developers
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

src/wallet/crypter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2009-2018 The Bitcoin Core developers
1+
// Copyright (c) 2009-2019 The Bitcoin Core developers
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

src/wallet/db.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright (c) 2009-2010 Satoshi Nakamoto
2-
// Copyright (c) 2009-2018 The Bitcoin Core developers
2+
// Copyright (c) 2009-2019 The Bitcoin Core developers
33
// Distributed under the MIT software license, see the accompanying
44
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

src/wallet/db.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright (c) 2009-2010 Satoshi Nakamoto
2-
// Copyright (c) 2009-2018 The Bitcoin Core developers
2+
// Copyright (c) 2009-2019 The Bitcoin Core developers
33
// Distributed under the MIT software license, see the accompanying
44
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

src/wallet/feebumper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2017-2018 The Bitcoin Core developers
1+
// Copyright (c) 2017-2019 The Bitcoin Core developers
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

src/wallet/feebumper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2017-2018 The Bitcoin Core developers
1+
// Copyright (c) 2017-2019 The Bitcoin Core developers
22
// Distributed under the MIT software license, see the accompanying
33
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
44

src/wallet/fees.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Copyright (c) 2009-2010 Satoshi Nakamoto
2-
// Copyright (c) 2009-2018 The Bitcoin Core developers
2+
// Copyright (c) 2009-2019 The Bitcoin Core developers
33
// Distributed under the MIT software license, see the accompanying
44
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
55

0 commit comments

Comments
 (0)