|
|
@ -418,10 +418,10 @@ Value stop(const Array& params, bool fHelp) |
|
|
|
if (fHelp || params.size() != 0) |
|
|
|
if (fHelp || params.size() != 0) |
|
|
|
throw runtime_error( |
|
|
|
throw runtime_error( |
|
|
|
"stop\n" |
|
|
|
"stop\n" |
|
|
|
"Stop bitcoin server."); |
|
|
|
"Stop Bitcoin server."); |
|
|
|
// Shutdown will take long enough that the response should get back
|
|
|
|
// Shutdown will take long enough that the response should get back
|
|
|
|
QueueShutdown(); |
|
|
|
QueueShutdown(); |
|
|
|
return "bitcoin server stopping"; |
|
|
|
return "Bitcoin server stopping"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -562,7 +562,7 @@ Value getnewaddress(const Array& params, bool fHelp) |
|
|
|
if (fHelp || params.size() > 1) |
|
|
|
if (fHelp || params.size() > 1) |
|
|
|
throw runtime_error( |
|
|
|
throw runtime_error( |
|
|
|
"getnewaddress [account]\n" |
|
|
|
"getnewaddress [account]\n" |
|
|
|
"Returns a new bitcoin address for receiving payments. " |
|
|
|
"Returns a new Bitcoin address for receiving payments. " |
|
|
|
"If [account] is specified (recommended), it is added to the address book " |
|
|
|
"If [account] is specified (recommended), it is added to the address book " |
|
|
|
"so payments received with the address will be credited to [account]."); |
|
|
|
"so payments received with the address will be credited to [account]."); |
|
|
|
|
|
|
|
|
|
|
@ -629,7 +629,7 @@ Value getaccountaddress(const Array& params, bool fHelp) |
|
|
|
if (fHelp || params.size() != 1) |
|
|
|
if (fHelp || params.size() != 1) |
|
|
|
throw runtime_error( |
|
|
|
throw runtime_error( |
|
|
|
"getaccountaddress <account>\n" |
|
|
|
"getaccountaddress <account>\n" |
|
|
|
"Returns the current bitcoin address for receiving payments to this account."); |
|
|
|
"Returns the current Bitcoin address for receiving payments to this account."); |
|
|
|
|
|
|
|
|
|
|
|
// Parse the account first so we don't generate a key if there's an error
|
|
|
|
// Parse the account first so we don't generate a key if there's an error
|
|
|
|
string strAccount = AccountFromValue(params[0]); |
|
|
|
string strAccount = AccountFromValue(params[0]); |
|
|
@ -652,7 +652,7 @@ Value setaccount(const Array& params, bool fHelp) |
|
|
|
|
|
|
|
|
|
|
|
CBitcoinAddress address(params[0].get_str()); |
|
|
|
CBitcoinAddress address(params[0].get_str()); |
|
|
|
if (!address.IsValid()) |
|
|
|
if (!address.IsValid()) |
|
|
|
throw JSONRPCError(-5, "Invalid bitcoin address"); |
|
|
|
throw JSONRPCError(-5, "Invalid Bitcoin address"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string strAccount; |
|
|
|
string strAccount; |
|
|
@ -682,7 +682,7 @@ Value getaccount(const Array& params, bool fHelp) |
|
|
|
|
|
|
|
|
|
|
|
CBitcoinAddress address(params[0].get_str()); |
|
|
|
CBitcoinAddress address(params[0].get_str()); |
|
|
|
if (!address.IsValid()) |
|
|
|
if (!address.IsValid()) |
|
|
|
throw JSONRPCError(-5, "Invalid bitcoin address"); |
|
|
|
throw JSONRPCError(-5, "Invalid Bitcoin address"); |
|
|
|
|
|
|
|
|
|
|
|
string strAccount; |
|
|
|
string strAccount; |
|
|
|
map<CBitcoinAddress, string>::iterator mi = pwalletMain->mapAddressBook.find(address); |
|
|
|
map<CBitcoinAddress, string>::iterator mi = pwalletMain->mapAddressBook.find(address); |
|
|
@ -743,7 +743,7 @@ Value sendtoaddress(const Array& params, bool fHelp) |
|
|
|
|
|
|
|
|
|
|
|
CBitcoinAddress address(params[0].get_str()); |
|
|
|
CBitcoinAddress address(params[0].get_str()); |
|
|
|
if (!address.IsValid()) |
|
|
|
if (!address.IsValid()) |
|
|
|
throw JSONRPCError(-5, "Invalid bitcoin address"); |
|
|
|
throw JSONRPCError(-5, "Invalid Bitcoin address"); |
|
|
|
|
|
|
|
|
|
|
|
// Amount
|
|
|
|
// Amount
|
|
|
|
int64 nAmount = AmountFromValue(params[1]); |
|
|
|
int64 nAmount = AmountFromValue(params[1]); |
|
|
@ -841,7 +841,7 @@ Value getreceivedbyaddress(const Array& params, bool fHelp) |
|
|
|
CBitcoinAddress address = CBitcoinAddress(params[0].get_str()); |
|
|
|
CBitcoinAddress address = CBitcoinAddress(params[0].get_str()); |
|
|
|
CScript scriptPubKey; |
|
|
|
CScript scriptPubKey; |
|
|
|
if (!address.IsValid()) |
|
|
|
if (!address.IsValid()) |
|
|
|
throw JSONRPCError(-5, "Invalid bitcoin address"); |
|
|
|
throw JSONRPCError(-5, "Invalid Bitcoin address"); |
|
|
|
scriptPubKey.SetBitcoinAddress(address); |
|
|
|
scriptPubKey.SetBitcoinAddress(address); |
|
|
|
if (!IsMine(*pwalletMain,scriptPubKey)) |
|
|
|
if (!IsMine(*pwalletMain,scriptPubKey)) |
|
|
|
return (double)0.0; |
|
|
|
return (double)0.0; |
|
|
@ -1067,7 +1067,7 @@ Value sendfrom(const Array& params, bool fHelp) |
|
|
|
string strAccount = AccountFromValue(params[0]); |
|
|
|
string strAccount = AccountFromValue(params[0]); |
|
|
|
CBitcoinAddress address(params[1].get_str()); |
|
|
|
CBitcoinAddress address(params[1].get_str()); |
|
|
|
if (!address.IsValid()) |
|
|
|
if (!address.IsValid()) |
|
|
|
throw JSONRPCError(-5, "Invalid bitcoin address"); |
|
|
|
throw JSONRPCError(-5, "Invalid Bitcoin address"); |
|
|
|
int64 nAmount = AmountFromValue(params[2]); |
|
|
|
int64 nAmount = AmountFromValue(params[2]); |
|
|
|
int nMinDepth = 1; |
|
|
|
int nMinDepth = 1; |
|
|
|
if (params.size() > 3) |
|
|
|
if (params.size() > 3) |
|
|
@ -1128,7 +1128,7 @@ Value sendmany(const Array& params, bool fHelp) |
|
|
|
{ |
|
|
|
{ |
|
|
|
CBitcoinAddress address(s.name_); |
|
|
|
CBitcoinAddress address(s.name_); |
|
|
|
if (!address.IsValid()) |
|
|
|
if (!address.IsValid()) |
|
|
|
throw JSONRPCError(-5, string("Invalid bitcoin address:")+s.name_); |
|
|
|
throw JSONRPCError(-5, string("Invalid Bitcoin address:")+s.name_); |
|
|
|
|
|
|
|
|
|
|
|
if (setAddress.count(address)) |
|
|
|
if (setAddress.count(address)) |
|
|
|
throw JSONRPCError(-8, string("Invalid parameter, duplicated address: ")+s.name_); |
|
|
|
throw JSONRPCError(-8, string("Invalid parameter, duplicated address: ")+s.name_); |
|
|
@ -1172,7 +1172,7 @@ Value addmultisigaddress(const Array& params, bool fHelp) |
|
|
|
{ |
|
|
|
{ |
|
|
|
string msg = "addmultisigaddress <nrequired> <'[\"key\",\"key\"]'> [account]\n" |
|
|
|
string msg = "addmultisigaddress <nrequired> <'[\"key\",\"key\"]'> [account]\n" |
|
|
|
"Add a nrequired-to-sign multisignature address to the wallet\"\n" |
|
|
|
"Add a nrequired-to-sign multisignature address to the wallet\"\n" |
|
|
|
"each key is a bitcoin address or hex-encoded public key\n" |
|
|
|
"each key is a Bitcoin address or hex-encoded public key\n" |
|
|
|
"If [account] is specified, assign address to [account]."; |
|
|
|
"If [account] is specified, assign address to [account]."; |
|
|
|
throw runtime_error(msg); |
|
|
|
throw runtime_error(msg); |
|
|
|
} |
|
|
|
} |
|
|
@ -1196,7 +1196,7 @@ Value addmultisigaddress(const Array& params, bool fHelp) |
|
|
|
{ |
|
|
|
{ |
|
|
|
const std::string& ks = keys[i].get_str(); |
|
|
|
const std::string& ks = keys[i].get_str(); |
|
|
|
|
|
|
|
|
|
|
|
// Case 1: bitcoin address and we have full public key:
|
|
|
|
// Case 1: Bitcoin address and we have full public key:
|
|
|
|
CBitcoinAddress address(ks); |
|
|
|
CBitcoinAddress address(ks); |
|
|
|
if (address.IsValid()) |
|
|
|
if (address.IsValid()) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -1933,7 +1933,7 @@ Value encryptwallet(const Array& params, bool fHelp) |
|
|
|
// slack space in .dat files; that is bad if the old data is
|
|
|
|
// slack space in .dat files; that is bad if the old data is
|
|
|
|
// unencrypted private keys. So:
|
|
|
|
// unencrypted private keys. So:
|
|
|
|
QueueShutdown(); |
|
|
|
QueueShutdown(); |
|
|
|
return "wallet encrypted; bitcoin server stopping, restart to run with encrypted wallet"; |
|
|
|
return "wallet encrypted; Bitcoin server stopping, restart to run with encrypted wallet"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|