aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortcatm <tcatm@gawab.com>2011-03-05 17:24:34 +0100
committertcatm <tcatm@gawab.com>2011-03-05 17:24:34 +0100
commit8e5aaada2e93e3a2f64135ece5ee09ad3d11cfe3 (patch)
treee0bf81411e4b05210a95811d00ca8aa5939657a9
parentc993ac69328177da7bcaa89e05f0a40133ed2bc6 (diff)
parentc1f74f152b278ca11390519fded87c09e7f05437 (diff)
downloadbitcoin-8e5aaada2e93e3a2f64135ece5ee09ad3d11cfe3.tar.xz
Merge branch 'setaccountfix' of https://github.com/TheBlueMatt/bitcoin into TheBlueMatt-setaccountfix
-rw-r--r--init.cpp2
-rw-r--r--net.cpp4
-rw-r--r--rpc.cpp6
-rw-r--r--util.cpp7
4 files changed, 15 insertions, 4 deletions
diff --git a/init.cpp b/init.cpp
index 04bdd68cde..9c84dca166 100644
--- a/init.cpp
+++ b/init.cpp
@@ -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") +
diff --git a/net.cpp b/net.cpp
index 0ba147bf75..d18b63eb5f 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();
diff --git a/rpc.cpp b/rpc.cpp
index 1c6f228e5b..dd94acc050 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 JSONRPCError(-5, "Invalid bitcoin address");
+
+
string strAccount;
if (params.size() > 1)
strAccount = AccountFromValue(params[1]);
diff --git a/util.cpp b/util.cpp
index 8518e27975..8a2f9d525e 100644
--- a/util.cpp
+++ b/util.cpp
@@ -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;