Skip to content

Commit

Permalink
Merge ElementsProject#625: Disallow issuance calls in bitcoin mode
Browse files Browse the repository at this point in the history
5de1e3f Disallow issuance calls in bitcoin mode (Gregory Sanders)

Pull request description:

  Enough people are running `-regtest` and getting confused as to why they cannot issue assets to make some checks worth it even though we don't intend people to run bitcoin mode at all.

Tree-SHA512: cb595839d01a000b5a48be4ae5c7084a687bb5c252be8f812f56455082ed78e66cb15313ab15934941cd403040ae253d8270faf6e85995d5caa0d1a66ccd3c6c
  • Loading branch information
stevenroose committed Jun 5, 2019
2 parents 1ccb0b6 + 5de1e3f commit c297714
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5977,6 +5977,10 @@ UniValue issueasset(const JSONRPCRequest& request)
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);

if (!g_con_elementsmode) {
throw JSONRPCError(RPC_TYPE_ERROR, "Issuance can only be done on elements-style chains. Note: `-regtest` is Bitcoin's regtest mode, instead try `-chain=<custom chain name>`");
}

CAmount nAmount = AmountFromValue(request.params[0]);
CAmount nTokens = AmountFromValue(request.params[1]);
if (nAmount == 0 && nTokens == 0) {
Expand Down Expand Up @@ -6068,6 +6072,10 @@ UniValue reissueasset(const JSONRPCRequest& request)
auto locked_chain = pwallet->chain().lock();
LOCK(pwallet->cs_wallet);

if (!g_con_elementsmode) {
throw JSONRPCError(RPC_TYPE_ERROR, "Issuance can only be done on elements-style chains. Note: `-regtest` is Bitcoin's regtest mode, instead try `-chain=<custom chain name>`");
}

std::string assetstr = request.params[0].get_str();
CAsset asset = GetAssetFromString(assetstr);

Expand Down

0 comments on commit c297714

Please sign in to comment.