From 6665aca02421e62c194dd8291b4ab7c91eea72c7 Mon Sep 17 00:00:00 2001 From: tcatm Date: Mon, 28 Feb 2011 04:53:22 +0100 Subject: [PATCH 1/5] fix missing newline in help --- init.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.cpp b/init.cpp index 04bdd68cd..9c84dca16 100644 --- a/init.cpp +++ b/init.cpp @@ -175,7 +175,7 @@ bool AppInit2(int argc, char* argv[]) " -proxy= \t " + _("Connect through socks4 proxy\n") + " -addnode= \t " + _("Add a node to connect to\n") + " -connect= \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= \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") + From 8a9cad44a57f1e0057c127ced5078d7e722b9cc8 Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Mon, 28 Feb 2011 21:34:36 +0000 Subject: [PATCH 2/5] Avoid sprintf decimal-point localization --- util.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/util.cpp b/util.cpp index 8518e2797..8a2f9d525 100644 --- a/util.cpp +++ b/util.cpp @@ -313,7 +313,12 @@ void ParseString(const string& str, char c, vector& 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; From f36b494aebcfe4cc6a45003520ee7d15eeaba8df Mon Sep 17 00:00:00 2001 From: Gavin Andresen Date: Thu, 3 Mar 2011 16:25:05 -0500 Subject: [PATCH 3/5] Make send/receive limits bigger (10MB each) --- net.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net.cpp b/net.cpp index 0ba147bf7..d18b63eb5 100644 --- a/net.cpp +++ b/net.cpp @@ -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(); From 279ab5e62f4e4344061d54b341d8d36af874fb88 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sat, 5 Mar 2011 15:32:32 +0100 Subject: [PATCH 4/5] setaccount should return if an invalid address is provided. This prevents setaccount from creating new accounts which do not have any addresses. --- rpc.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rpc.cpp b/rpc.cpp index 1c6f228e5..e01ea0e3b 100644 --- a/rpc.cpp +++ b/rpc.cpp @@ -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 runtime_error("provided address is not valid"); + + string strAccount; if (params.size() > 1) strAccount = AccountFromValue(params[1]); From c1f74f152b278ca11390519fded87c09e7f05437 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sat, 5 Mar 2011 16:45:56 +0100 Subject: [PATCH 5/5] throw JSONRPCError(-5, "Invalid bitcoin address") instead. --- rpc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rpc.cpp b/rpc.cpp index e01ea0e3b..dd94acc05 100644 --- a/rpc.cpp +++ b/rpc.cpp @@ -384,7 +384,7 @@ Value setaccount(const Array& params, bool fHelp) uint160 hash160; bool isValid = AddressToHash160(strAddress, hash160); if (!isValid) - throw runtime_error("provided address is not valid"); + throw JSONRPCError(-5, "Invalid bitcoin address"); string strAccount;