Skip to content

Commit ef0aa74

Browse files
committed
rpc: wallet: remove -deprecatedrpc=exclude_coinbase logic
1 parent e18fd47 commit ef0aa74

File tree

3 files changed

+2
-49
lines changed

3 files changed

+2
-49
lines changed

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)