From 2ce154d60efed158f51d76eb6a8787e939097d37 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 24 Sep 2018 00:36:18 -1100 Subject: [PATCH] Allow sendtoaddress for PIRATE to notary --- src/wallet/rpcwallet.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 5a14370c4..e02cad35f 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -398,7 +398,7 @@ static void SendMoney(const CTxDestination &address, CAmount nValue, bool fSubtr // Parse Zcash address CScript scriptPubKey = GetScriptForDestination(address); - + // Create and send the transaction CReserveKey reservekey(pwalletMain); CAmount nFeeRequired; @@ -430,6 +430,8 @@ static void SendMoney(const CTxDestination &address, CAmount nValue, bool fSubtr throw JSONRPCError(RPC_WALLET_ERROR, "Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here."); } +int32_t komodo_isnotaryvout(char *coinaddr); + UniValue sendtoaddress(const UniValue& params, bool fHelp) { if (!EnsureWalletIsAvailable(fHelp)) @@ -460,8 +462,12 @@ UniValue sendtoaddress(const UniValue& params, bool fHelp) ); if ( ASSETCHAINS_PRIVATE != 0 && AmountFromValue(params[1]) > 0 ) - throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid " + strprintf("%s",komodo_chainname()) + " address"); - + { + if ( komodo_isnotaryvout((char *)params[0].get_str().c_ctr()) == 0 ) + { + throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid " + strprintf("%s",komodo_chainname()) + " address"); + } + } LOCK2(cs_main, pwalletMain->cs_wallet); CBitcoinAddress address(params[0].get_str());