Skip to content

Commit

Permalink
Add IS parameter for gobject prepare (#2452)
Browse files Browse the repository at this point in the history
* Add IS parameter for gobject prepare

* Update if statement

Co-Authored-By: PastaPastaPasta <[email protected]>

* Update src/rpc/governance.cpp

Co-Authored-By: PastaPastaPasta <[email protected]>

* Update src/rpc/governance.cpp

Co-Authored-By: PastaPastaPasta <[email protected]>
  • Loading branch information
PastaPastaPasta authored and UdjinM6 committed Nov 25, 2018
1 parent 65528e9 commit 45421b1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/rpc/governance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,13 @@ void gobject_prepare_help()
"2. revision (numeric, required) object revision in the system\n"
"3. time (numeric, required) time this object was created\n"
"4. data-hex (string, required) data in hex string form\n"
"5. use-IS (boolean, optional, default=false) InstantSend lock the collateral, only requiring one chain confirmation\n"
);
}

UniValue gobject_prepare(const JSONRPCRequest& request)
{
if (request.fHelp || request.params.size() != 5)
if (request.fHelp || (request.params.size() != 5 && request.params.size() != 6))
gobject_prepare_help();

if (!EnsureWalletIsAvailable(request.fHelp))
Expand All @@ -159,6 +160,8 @@ UniValue gobject_prepare(const JSONRPCRequest& request)
int nRevision = atoi(strRevision);
int64_t nTime = atoi64(strTime);
std::string strDataHex = request.params[4].get_str();
bool useIS = false;
if (request.params.size() > 5) useIS = request.params[5].getBool();

// CREATE A NEW COLLATERAL TRANSACTION FOR THIS SPECIFIC OBJECT

Expand Down Expand Up @@ -197,7 +200,7 @@ UniValue gobject_prepare(const JSONRPCRequest& request)
EnsureWalletIsUnlocked();

CWalletTx wtx;
if (!pwalletMain->GetBudgetSystemCollateralTX(wtx, govobj.GetHash(), govobj.GetMinCollateralFee(), false)) {
if (!pwalletMain->GetBudgetSystemCollateralTX(wtx, govobj.GetHash(), govobj.GetMinCollateralFee(), useIS)) {
throw JSONRPCError(RPC_INTERNAL_ERROR, "Error making collateral transaction for governance object. Please check your wallet balance and make sure your wallet is unlocked.");
}

Expand Down

0 comments on commit 45421b1

Please sign in to comment.