Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/rpc/mining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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=<custom chain name>`");
}

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.");
Expand Down Expand Up @@ -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=<custom chain name>`");
}

CBlock block;
std::vector<unsigned char> block_bytes(ParseHex(request.params[0].get_str()));
CDataStream ssBlock(block_bytes, SER_NETWORK, PROTOCOL_VERSION);
Expand Down Expand Up @@ -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=<custom chain name>`");
}

UniValue ret(UniValue::VOBJ);

std::vector<unsigned char> compact_block_bytes(ParseHex(request.params[0].get_str()));
Expand Down Expand Up @@ -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=<custom chain name>`");
}

CBlock block;
std::vector<unsigned char> block_bytes(ParseHex(request.params[0].get_str()));
CDataStream ssBlock(block_bytes, SER_NETWORK, PROTOCOL_VERSION);
Expand Down Expand Up @@ -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=<custom chain name>`");
}

// Compact block
std::vector<unsigned char> compact_block_bytes(ParseHex(request.params[0].get_str()));
CDataStream ssCompactBlock(compact_block_bytes, SER_NETWORK, PROTOCOL_VERSION);
Expand Down Expand Up @@ -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=<custom chain name>`");
}

CBlock block;
if (!DecodeHexBlk(block, request.params[0].get_str()))
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block decode failed");
Expand Down
8 changes: 8 additions & 0 deletions src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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=<custom chain name>`");
}

auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);

Expand Down Expand Up @@ -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=<custom chain name>`");
}

auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);

Expand Down