aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/interfaces/chain.cpp1
-rw-r--r--src/interfaces/chain.h3
-rw-r--r--src/node/transaction.cpp3
-rw-r--r--src/wallet/rpcwallet.cpp8
4 files changed, 3 insertions, 12 deletions
diff --git a/src/interfaces/chain.cpp b/src/interfaces/chain.cpp
index 1ad4308f29..b8b9ecded9 100644
--- a/src/interfaces/chain.cpp
+++ b/src/interfaces/chain.cpp
@@ -332,7 +332,6 @@ public:
LOCK(cs_main);
return ::fHavePruned;
}
- bool p2pEnabled() override { return g_connman != nullptr; }
bool isReadyToBroadcast() override { return !::fImporting && !::fReindex && !isInitialBlockDownload(); }
bool isInitialBlockDownload() override { return ::ChainstateActive().IsInitialBlockDownload(); }
bool shutdownRequested() override { return ShutdownRequested(); }
diff --git a/src/interfaces/chain.h b/src/interfaces/chain.h
index 1d6ed05522..da670a3370 100644
--- a/src/interfaces/chain.h
+++ b/src/interfaces/chain.h
@@ -187,9 +187,6 @@ public:
//! Check if any block has been pruned.
virtual bool havePruned() = 0;
- //! Check if p2p enabled.
- virtual bool p2pEnabled() = 0;
-
//! Check if the node is ready to broadcast transactions.
virtual bool isReadyToBroadcast() = 0;
diff --git a/src/node/transaction.cpp b/src/node/transaction.cpp
index 8e56496358..a28136a8e8 100644
--- a/src/node/transaction.cpp
+++ b/src/node/transaction.cpp
@@ -16,6 +16,9 @@
TransactionError BroadcastTransaction(const CTransactionRef tx, std::string& err_string, const CAmount& max_tx_fee, bool relay, bool wait_callback)
{
+ // BroadcastTransaction can be called by either sendrawtransaction RPC or wallet RPCs.
+ // g_connman is assigned both before chain clients and before RPC server is accepting calls,
+ // and reset after chain clients and RPC sever are stopped. g_connman should never be null here.
assert(g_connman);
std::promise<void> promise;
uint256 hashTx = tx->GetHash();
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index f94214b6ee..cbab73d612 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -309,10 +309,6 @@ static CTransactionRef SendMoney(interfaces::Chain::Lock& locked_chain, CWallet
if (nValue > curBalance)
throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Insufficient funds");
- if (pwallet->GetBroadcastTransactions() && !pwallet->chain().p2pEnabled()) {
- throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
- }
-
// Parse Bitcoin address
CScript scriptPubKey = GetScriptForDestination(address);
@@ -845,10 +841,6 @@ static UniValue sendmany(const JSONRPCRequest& request)
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);
- if (pwallet->GetBroadcastTransactions() && !pwallet->chain().p2pEnabled()) {
- throw JSONRPCError(RPC_CLIENT_P2P_DISABLED, "Error: Peer-to-peer functionality missing or disabled");
- }
-
if (!request.params[0].isNull() && !request.params[0].get_str().empty()) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Dummy value must be set to \"\"");
}