diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -3036,6 +3036,7 @@ "Intended only for testing; the wallet code periodically " "re-broadcasts\n" "automatically.\n" + "Returns an RPC error if -walletbroadcast is set to false.\n" "Returns array of transaction ids that were re-broadcast.\n"); } @@ -3047,6 +3048,12 @@ LOCK2(cs_main, pwallet->cs_wallet); + if (!pwallet->GetBroadcastTransactions()) { + throw JSONRPCError(RPC_WALLET_ERROR, "Error: Wallet transaction " + "broadcasting is disabled with " + "-walletbroadcast"); + } + std::vector txids = pwallet->ResendWalletTransactionsBefore(GetTime(), g_connman.get()); UniValue result(UniValue::VARR); diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -453,6 +453,7 @@ int64_t GetTxTime() const; int GetRequestCount() const; + // RelayWalletTransaction may only be called if fBroadcastTransactions! bool RelayWalletTransaction(CConnman *connman); std::set GetConflicts() const; @@ -877,6 +878,8 @@ void ReacceptWalletTransactions(); void ResendWalletTransactions(int64_t nBestBlockTime, CConnman *connman) override; + // ResendWalletTransactionsBefore may only be called if + // fBroadcastTransactions! std::vector ResendWalletTransactionsBefore(int64_t nTime, CConnman *connman); Amount GetBalance() const; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2102,6 +2102,7 @@ std::vector result; LOCK(cs_wallet); + // Sort them in chronological order std::multimap mapSorted; for (std::pair &item : mapWallet) {