diff options
author | tcatm <tcatm@gawab.com> | 2011-03-05 17:24:34 +0100 |
---|---|---|
committer | tcatm <tcatm@gawab.com> | 2011-03-05 17:24:34 +0100 |
commit | 8e5aaada2e93e3a2f64135ece5ee09ad3d11cfe3 (patch) | |
tree | e0bf81411e4b05210a95811d00ca8aa5939657a9 | |
parent | c993ac69328177da7bcaa89e05f0a40133ed2bc6 (diff) | |
parent | c1f74f152b278ca11390519fded87c09e7f05437 (diff) |
Merge branch 'setaccountfix' of https://github.com/TheBlueMatt/bitcoin into TheBlueMatt-setaccountfix
-rw-r--r-- | init.cpp | 2 | ||||
-rw-r--r-- | net.cpp | 4 | ||||
-rw-r--r-- | rpc.cpp | 6 | ||||
-rw-r--r-- | util.cpp | 7 |
4 files changed, 15 insertions, 4 deletions
@@ -175,7 +175,7 @@ bool AppInit2(int argc, char* argv[]) " -proxy=<ip:port> \t " + _("Connect through socks4 proxy\n") + " -addnode=<ip> \t " + _("Add a node to connect to\n") + " -connect=<ip> \t\t " + _("Connect only to the specified node\n") + - " -nolisten \t " + _("Don't accept connections from outside") + + " -nolisten \t " + _("Don't accept connections from outside\n") + " -paytxfee=<amt> \t " + _("Fee per KB to add to transactions you send\n") + " -server \t\t " + _("Accept command line and JSON-RPC commands\n") + " -daemon \t\t " + _("Run in the background as a daemon and accept commands\n") + @@ -741,7 +741,7 @@ void ThreadSocketHandler2(void* parg) CDataStream& vRecv = pnode->vRecv; unsigned int nPos = vRecv.size(); - if (nPos > 1000*GetArg("-maxreceivebuffer", 2*1000)) { + if (nPos > 1000*GetArg("-maxreceivebuffer", 10*1000)) { if (!pnode->fDisconnect) printf("socket recv flood control disconnect (%d bytes)\n", vRecv.size()); pnode->CloseSocketDisconnect(); @@ -806,7 +806,7 @@ void ThreadSocketHandler2(void* parg) pnode->CloseSocketDisconnect(); } } - if (vSend.size() > 1000*GetArg("-maxsendbuffer", 256)) { + if (vSend.size() > 1000*GetArg("-maxsendbuffer", 10*1000)) { if (!pnode->fDisconnect) printf("socket send flood control disconnect (%d bytes)\n", vSend.size()); pnode->CloseSocketDisconnect(); @@ -381,6 +381,12 @@ Value setaccount(const Array& params, bool fHelp) "Sets the account associated with the given address."); string strAddress = params[0].get_str(); + uint160 hash160; + bool isValid = AddressToHash160(strAddress, hash160); + if (!isValid) + throw JSONRPCError(-5, "Invalid bitcoin address"); + + string strAccount; if (params.size() > 1) strAccount = AccountFromValue(params[1]); @@ -313,7 +313,12 @@ void ParseString(const string& str, char c, vector<string>& v) string FormatMoney(int64 n, bool fPlus) { - string str = strprintf("%.08f", double(n > 0 ? n : -n)/double(COIN)); + // Note: not using straight sprintf here because we do NOT want + // localized number formatting. + int64 n_abs = (n > 0 ? n : -n); + int64 quotient = n_abs/COIN; + int64 remainder = n_abs%COIN; + string str = strprintf("%"PRI64d".%08"PRI64d, quotient, remainder); // Right-trim excess 0's before the decimal point: int nTrim = 0; |