Skip to content

Commit f516245

Browse files
committed
[rpc] remove resendwallettransactions RPC
This RPC was added for testing wallet rebroadcasts. Since we now have a real test for wallet rebroadcasts, it's no longer needed. The call in wallet_basic.py can be removed because wallet_resendwallettransactions.py tests wallet rebroadcast.
1 parent 0baf4b1 commit f516245

File tree

2 files changed

+1
-61
lines changed

2 files changed

+1
-61
lines changed

src/wallet/rpcwallet.cpp

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2668,50 +2668,6 @@ static UniValue unloadwallet(const JSONRPCRequest& request)
26682668
return NullUniValue;
26692669
}
26702670

2671-
static UniValue resendwallettransactions(const JSONRPCRequest& request)
2672-
{
2673-
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
2674-
CWallet* const pwallet = wallet.get();
2675-
2676-
if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) {
2677-
return NullUniValue;
2678-
}
2679-
2680-
if (request.fHelp || request.params.size() != 0)
2681-
throw std::runtime_error(
2682-
RPCHelpMan{"resendwallettransactions",
2683-
"Immediately re-broadcast unconfirmed wallet transactions to all peers.\n"
2684-
"Intended only for testing; the wallet code periodically re-broadcasts\n"
2685-
"automatically.\n",
2686-
{},
2687-
RPCResult{
2688-
"Returns an RPC error if -walletbroadcast is set to false.\n"
2689-
"Returns array of transaction ids that were re-broadcast.\n"
2690-
},
2691-
RPCExamples{""},
2692-
}.ToString()
2693-
);
2694-
2695-
if (!pwallet->chain().p2pEnabled()) {
2696-
throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
2697-
}
2698-
2699-
auto locked_chain = pwallet->chain().lock();
2700-
LOCK(pwallet->cs_wallet);
2701-
2702-
if (!pwallet->GetBroadcastTransactions()) {
2703-
throw JSONRPCError(RPC_WALLET_ERROR, "Error: Wallet transaction broadcasting is disabled with -walletbroadcast");
2704-
}
2705-
2706-
std::vector<uint256> txids = pwallet->ResendWalletTransactionsBefore(*locked_chain, GetTime());
2707-
UniValue result(UniValue::VARR);
2708-
for (const uint256& txid : txids)
2709-
{
2710-
result.push_back(txid.ToString());
2711-
}
2712-
return result;
2713-
}
2714-
27152671
static UniValue listunspent(const JSONRPCRequest& request)
27162672
{
27172673
std::shared_ptr<CWallet> const wallet = GetWalletForJSONRPCRequest(request);
@@ -4085,7 +4041,6 @@ UniValue importmulti(const JSONRPCRequest& request);
40854041
static const CRPCCommand commands[] =
40864042
{ // category name actor (function) argNames
40874043
// --------------------- ------------------------ ----------------------- ----------
4088-
{ "hidden", "resendwallettransactions", &resendwallettransactions, {} },
40894044
{ "rawtransactions", "fundrawtransaction", &fundrawtransaction, {"hexstring","options","iswitness"} },
40904045
{ "wallet", "abandontransaction", &abandontransaction, {"txid"} },
40914046
{ "wallet", "abortrescan", &abortrescan, {} },

test/functional/wallet_basic.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
assert_raises_rpc_error,
1515
connect_nodes_bi,
1616
sync_blocks,
17-
sync_mempools,
1817
wait_until,
1918
)
2019

@@ -216,23 +215,9 @@ def run_test(self):
216215
assert_equal(self.nodes[2].getbalance(), node_2_bal)
217216
node_0_bal = self.check_fee_amount(self.nodes[0].getbalance(), node_0_bal + Decimal('10'), fee_per_byte, self.get_vsize(self.nodes[2].gettransaction(txid)['hex']))
218217

219-
# Test ResendWalletTransactions:
220-
# Create a couple of transactions, then start up a fourth
221-
# node (nodes[3]) and ask nodes[0] to rebroadcast.
222-
# EXPECT: nodes[3] should have those transactions in its mempool.
223-
txid1 = self.nodes[0].sendtoaddress(self.nodes[1].getnewaddress(), 1)
224-
txid2 = self.nodes[1].sendtoaddress(self.nodes[0].getnewaddress(), 1)
225-
sync_mempools(self.nodes[0:2])
226-
227218
self.start_node(3)
228219
connect_nodes_bi(self.nodes, 0, 3)
229-
sync_blocks(self.nodes)
230-
231-
relayed = self.nodes[0].resendwallettransactions()
232-
assert_equal(set(relayed), {txid1, txid2})
233-
sync_mempools(self.nodes)
234-
235-
assert txid1 in self.nodes[3].getrawmempool()
220+
self.sync_all()
236221

237222
# check if we can list zero value tx as available coins
238223
# 1. create raw_tx

0 commit comments

Comments
 (0)