diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index 1bd87f368ab..69bccf0b6a5 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -1024,6 +1024,10 @@ UniValue getnewblockhex(const JSONRPCRequest& request) } }.ToString()); + if (!g_con_elementsmode) { + throw JSONRPCError(RPC_INVALID_PARAMETER, "This RPC cannot be used in bitcoin compatibility mode. Note: `-regtest` is Bitcoin's regtest mode, instead try `-chain=`"); + } + int required_wait = !request.params[0].isNull() ? request.params[0].get_int() : 0; if (required_wait < 0) { throw JSONRPCError(RPC_INVALID_PARAMETER, "min_tx_age must be non-negative."); @@ -1200,6 +1204,10 @@ UniValue getcompactsketch(const JSONRPCRequest& request) } }.ToString()); + if (!g_con_elementsmode) { + throw JSONRPCError(RPC_INVALID_PARAMETER, "This RPC cannot be used in bitcoin compatibility mode. Note: `-regtest` is Bitcoin's regtest mode, instead try `-chain=`"); + } + CBlock block; std::vector block_bytes(ParseHex(request.params[0].get_str())); CDataStream ssBlock(block_bytes, SER_NETWORK, PROTOCOL_VERSION); @@ -1238,6 +1246,10 @@ UniValue consumecompactsketch(const JSONRPCRequest& request) } }.ToString()); + if (!g_con_elementsmode) { + throw JSONRPCError(RPC_INVALID_PARAMETER, "This RPC cannot be used in bitcoin compatibility mode. Note: `-regtest` is Bitcoin's regtest mode, instead try `-chain=`"); + } + UniValue ret(UniValue::VOBJ); std::vector compact_block_bytes(ParseHex(request.params[0].get_str())); @@ -1307,6 +1319,10 @@ UniValue consumegetblocktxn(const JSONRPCRequest& request) } }.ToString()); + if (!g_con_elementsmode) { + throw JSONRPCError(RPC_INVALID_PARAMETER, "This RPC cannot be used in bitcoin compatibility mode. Note: `-regtest` is Bitcoin's regtest mode, instead try `-chain=`"); + } + CBlock block; std::vector block_bytes(ParseHex(request.params[0].get_str())); CDataStream ssBlock(block_bytes, SER_NETWORK, PROTOCOL_VERSION); @@ -1352,6 +1368,10 @@ UniValue finalizecompactblock(const JSONRPCRequest& request) } }.ToString()); + if (!g_con_elementsmode) { + throw JSONRPCError(RPC_INVALID_PARAMETER, "This RPC cannot be used in bitcoin compatibility mode. Note: `-regtest` is Bitcoin's regtest mode, instead try `-chain=`"); + } + // Compact block std::vector compact_block_bytes(ParseHex(request.params[0].get_str())); CDataStream ssCompactBlock(compact_block_bytes, SER_NETWORK, PROTOCOL_VERSION); @@ -1406,6 +1426,10 @@ UniValue testproposedblock(const JSONRPCRequest& request) } }.ToString()); + if (!g_con_elementsmode) { + throw JSONRPCError(RPC_INVALID_PARAMETER, "This RPC cannot be used in bitcoin compatibility mode. Note: `-regtest` is Bitcoin's regtest mode, instead try `-chain=`"); + } + CBlock block; if (!DecodeHexBlk(block, request.params[0].get_str())) throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block decode failed"); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 69dec5f75fd..b826c02ce36 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -6350,6 +6350,10 @@ UniValue listissuances(const JSONRPCRequest& request) }, }.ToString()); + if (!g_con_elementsmode) { + throw JSONRPCError(RPC_INVALID_PARAMETER, "This RPC cannot be used in bitcoin compatibility mode. Note: `-regtest` is Bitcoin's regtest mode, instead try `-chain=`"); + } + auto locked_chain = pwallet->chain().lock(); LOCK(pwallet->cs_wallet); @@ -6437,6 +6441,10 @@ UniValue destroyamount(const JSONRPCRequest& request) }, }.ToString()); + if (!g_con_elementsmode) { + throw JSONRPCError(RPC_INVALID_PARAMETER, "This RPC cannot be used in bitcoin compatibility mode. Note: `-regtest` is Bitcoin's regtest mode, instead try `-chain=`"); + } + auto locked_chain = pwallet->chain().lock(); LOCK(pwallet->cs_wallet);