Browse Source

Add rpc command 'getunconfirmedbalance' to obtain total unconfirmed balance

Conflicts:
	src/rpcserver.cpp
pull/1/head
Michael Bauer 9 years ago
parent
commit
6027b460e4
  1. 1
      src/rpcserver.cpp
  2. 1
      src/rpcserver.h
  3. 9
      src/rpcwallet.cpp

1
src/rpcserver.cpp

@ -253,6 +253,7 @@ static const CRPCCommand vRPCCommands[] = @@ -253,6 +253,7 @@ static const CRPCCommand vRPCCommands[] =
{ "encryptwallet", &encryptwallet, false, false, true },
{ "validateaddress", &validateaddress, true, false, false },
{ "getbalance", &getbalance, false, false, true },
{ "getunconfirmedbalance", &getunconfirmedbalance, false, false, true },
{ "move", &movecmd, false, false, true },
{ "sendfrom", &sendfrom, false, false, true },
{ "sendmany", &sendmany, false, false, true },

1
src/rpcserver.h

@ -135,6 +135,7 @@ extern json_spirit::Value verifymessage(const json_spirit::Array& params, bool f @@ -135,6 +135,7 @@ extern json_spirit::Value verifymessage(const json_spirit::Array& params, bool f
extern json_spirit::Value getreceivedbyaddress(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value getreceivedbyaccount(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value getbalance(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value getunconfirmedbalance(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value movecmd(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value sendfrom(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value sendmany(const json_spirit::Array& params, bool fHelp);

9
src/rpcwallet.cpp

@ -767,6 +767,15 @@ Value getbalance(const Array& params, bool fHelp) @@ -767,6 +767,15 @@ Value getbalance(const Array& params, bool fHelp)
return ValueFromAmount(nBalance);
}
Value getunconfirmedbalance(const Array &params, bool fHelp)
{
if (fHelp || params.size() > 0)
throw runtime_error(
"getunconfirmedbalance\n"
"Returns the server's total unconfirmed balance\n");
return ValueFromAmount(pwalletMain->GetUnconfirmedBalance());
}
Value movecmd(const Array& params, bool fHelp)
{

Loading…
Cancel
Save