Browse Source

Allow notary addresses in sendmany, fixes #126

pull/305/head
Duke Leto 2 years ago
parent
commit
689a360b60
  1. 13
      src/wallet/rpcwallet.cpp

13
src/wallet/rpcwallet.cpp

@ -1502,8 +1502,6 @@ UniValue sendmany(const UniValue& params, bool fHelp, const CPubKey& mypk)
"\nAs a json rpc call\n"
+ HelpExampleRpc("sendmany", "\"\", {\"RD6GgnrMpPaTSMn8vai6yiGA7mN4QGPVMY\":0.01,\"RRyyejME7LRTuvdziWsXkAbSW1fdiohGwK\":0.02}, 6, \"testing\"")
);
if ( ASSETCHAINS_PRIVATE != 0 )
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "cant use transparent addresses in private chain");
LOCK2(cs_main, pwalletMain->cs_wallet);
@ -1528,6 +1526,17 @@ UniValue sendmany(const UniValue& params, bool fHelp, const CPubKey& mypk)
std::vector<std::string> keys = sendTo.getKeys();
int32_t i = 0;
for (const std::string& name_ : keys) {
// Allow transparent notary addresses and throw an error for anything else
// This is also a consensus check but we want to prevent it from going into the mempool
// and give an error as early as possible
if ( ASSETCHAINS_PRIVATE != 0 )
{
if ( hush_isnotaryvout((char *)name_.c_str(),chainActive.LastTip()->nTime) == 0 )
{
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Transparent " + strprintf("%s",hush_chainname()) + " address not allowed on private chain");
}
}
CTxDestination dest = DecodeDestination(name_);
if (!IsValidDestination(dest)) {
CScript tmpspk;

Loading…
Cancel
Save