Browse Source

Merge branch 'setaccountfix' of https://github.com/TheBlueMatt/bitcoin into TheBlueMatt-setaccountfix

0.8
tcatm 14 years ago
parent
commit
8e5aaada2e
  1. 2
      init.cpp
  2. 4
      net.cpp
  3. 6
      rpc.cpp
  4. 7
      util.cpp

2
init.cpp

@ -175,7 +175,7 @@ bool AppInit2(int argc, char* argv[]) @@ -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") +

4
net.cpp

@ -741,7 +741,7 @@ void ThreadSocketHandler2(void* parg) @@ -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) @@ -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();

6
rpc.cpp

@ -381,6 +381,12 @@ Value setaccount(const Array& params, bool fHelp) @@ -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]);

7
util.cpp

@ -313,7 +313,12 @@ void ParseString(const string& str, char c, vector<string>& v) @@ -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;

Loading…
Cancel
Save