Skip to content

Commit a7e3afb

Browse files
author
MacroFake
committed
Merge bitcoin/bitcoin#25171: rpc: wallet: remove -deprecatedrpc=exclude_coinbase logic
a4703ce doc: add release notes about removal of the `deprecatedrpc=exclude_coinbase` (Sebastian Falbesoner) ef0aa74 rpc: wallet: remove `-deprecatedrpc=exclude_coinbase` logic (Sebastian Falbesoner) Pull request description: Including coinbase transactions in `receivedby` RPCs and adding the `-deprecatedrpc=exclude_coinbase` was done in PR #14707 (released in v23.0). For the next release v24.0, this configuration option can be removed. ACKs for top commit: fanquake: ACK a4703ce Tree-SHA512: 97cd4e78501e64f678c78d2ebb5be5376688c023e34fced71dd24e432d27aa31a74b5483545f49ba0bdf48656d8b8b7bee74e3db26cf6daf112613f1caa4dfa4
2 parents a39002e + a4703ce commit a7e3afb

File tree

4 files changed

+9
-49
lines changed

4 files changed

+9
-49
lines changed

doc/release-notes.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ Updated RPCs
5555
previously deprecated in 23.0. (#23508) Information on soft fork status is
5656
now only available via the `getdeploymentinfo` RPC.
5757

58+
- The `deprecatedrpc=exclude_coinbase` configuration option has been removed.
59+
The `receivedby` RPCs (`listreceivedbyaddress`, `listreceivedbylabel`,
60+
`getreceivedbyaddress` and `getreceivedbylabel`) now always return results
61+
accounting for received coins from coinbase outputs, without an option to
62+
change that behaviour. Excluding coinbases was previously deprecated in 23.0.
63+
(#25171)
64+
5865
Changes to wallet related RPCs can be found in the Wallet section below.
5966

6067
New RPCs

src/wallet/rpc/coins.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,22 +49,14 @@ static CAmount GetReceived(const CWallet& wallet, const UniValue& params, bool b
4949

5050
const bool include_immature_coinbase{params[2].isNull() ? false : params[2].get_bool()};
5151

52-
// Excluding coinbase outputs is deprecated
53-
// It can be enabled by setting deprecatedrpc=exclude_coinbase
54-
const bool include_coinbase{!wallet.chain().rpcEnableDeprecated("exclude_coinbase")};
55-
56-
if (include_immature_coinbase && !include_coinbase) {
57-
throw JSONRPCError(RPC_INVALID_PARAMETER, "include_immature_coinbase is incompatible with deprecated exclude_coinbase");
58-
}
59-
6052
// Tally
6153
CAmount amount = 0;
6254
for (const std::pair<const uint256, CWalletTx>& wtx_pair : wallet.mapWallet) {
6355
const CWalletTx& wtx = wtx_pair.second;
6456
int depth{wallet.GetTxDepthInMainChain(wtx)};
6557
if (depth < min_depth
6658
// Coinbase with less than 1 confirmation is no longer in the main chain
67-
|| (wtx.IsCoinBase() && (depth < 1 || !include_coinbase))
59+
|| (wtx.IsCoinBase() && (depth < 1))
6860
|| (wallet.IsTxImmatureCoinBase(wtx) && !include_immature_coinbase))
6961
{
7062
continue;

src/wallet/rpc/transactions.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,6 @@ static UniValue ListReceived(const CWallet& wallet, const UniValue& params, cons
9595
has_filtered_address = true;
9696
}
9797

98-
// Excluding coinbase outputs is deprecated
99-
// It can be enabled by setting deprecatedrpc=exclude_coinbase
100-
const bool include_coinbase{!wallet.chain().rpcEnableDeprecated("exclude_coinbase")};
101-
102-
if (include_immature_coinbase && !include_coinbase) {
103-
throw JSONRPCError(RPC_INVALID_PARAMETER, "include_immature_coinbase is incompatible with deprecated exclude_coinbase");
104-
}
105-
10698
// Tally
10799
std::map<CTxDestination, tallyitem> mapTally;
108100
for (const std::pair<const uint256, CWalletTx>& pairWtx : wallet.mapWallet) {
@@ -113,7 +105,7 @@ static UniValue ListReceived(const CWallet& wallet, const UniValue& params, cons
113105
continue;
114106

115107
// Coinbase with less than 1 confirmation is no longer in the main chain
116-
if ((wtx.IsCoinBase() && (nDepth < 1 || !include_coinbase))
108+
if ((wtx.IsCoinBase() && (nDepth < 1))
117109
|| (wallet.IsTxImmatureCoinBase(wtx) && !include_immature_coinbase))
118110
{
119111
continue;

test/functional/wallet_listreceivedby.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
class ReceivedByTest(BitcoinTestFramework):
1919
def set_test_params(self):
2020
self.num_nodes = 2
21-
# Test deprecated exclude coinbase on second node
22-
self.extra_args = [[], ["-deprecatedrpc=exclude_coinbase"]]
2321

2422
def skip_test_if_missing_module(self):
2523
self.skip_if_no_wallet()
@@ -250,35 +248,6 @@ def run_test(self):
250248
{"label": label},
251249
{}, True)
252250

253-
# Test exclude_coinbase
254-
address2 = self.nodes[1].getnewaddress(label)
255-
self.generatetoaddress(self.nodes[1], COINBASE_MATURITY + 1, address2, sync_fun=self.no_op)
256-
257-
self.log.info("getreceivedbyaddress returns nothing when excluding coinbase")
258-
balance = self.nodes[1].getreceivedbyaddress(address2)
259-
assert_equal(balance, 0)
260-
261-
self.log.info("getreceivedbylabel returns nothing when excluding coinbase")
262-
balance = self.nodes[1].getreceivedbylabel("label")
263-
assert_equal(balance, 0)
264-
265-
self.log.info("listreceivedbyaddress does not include address when excluding coinbase")
266-
assert_array_result(self.nodes[1].listreceivedbyaddress(),
267-
{"address": address2},
268-
{}, True)
269-
270-
self.log.info("listreceivedbylabel does not include label when excluding coinbase")
271-
assert_array_result(self.nodes[1].listreceivedbylabel(),
272-
{"label": label},
273-
{}, True)
274-
275-
self.log.info("getreceivedbyaddress throws when setting include_immature_coinbase with deprecated exclude_coinbase")
276-
assert_raises_rpc_error(-8, 'include_immature_coinbase is incompatible with deprecated exclude_coinbase', self.nodes[1].getreceivedbyaddress, address2, 1, True)
277-
278-
279-
self.log.info("listreceivedbyaddress throws when setting include_immature_coinbase with deprecated exclude_coinbase")
280-
assert_raises_rpc_error(-8, 'include_immature_coinbase is incompatible with deprecated exclude_coinbase', self.nodes[1].listreceivedbyaddress, 1, False, False, "", True)
281-
282251

283252
if __name__ == '__main__':
284253
ReceivedByTest().main()

0 commit comments

Comments
 (0)