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

This commit is contained in:
tcatm 2011-03-05 17:24:34 +01:00
commit 8e5aaada2e
4 changed files with 15 additions and 4 deletions

View file

@ -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") +

View file

@ -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();

View file

@ -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]);

View file

@ -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;