aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGavin Andresen <[email protected]>2010-10-22 11:23:12 -0400
committerGavin Andresen <[email protected]>2010-10-22 11:23:12 -0400
commit2ea321d85ae6068b659680e914b06d8862ef66ef (patch)
treede2d513b9a028e8d204beaeab3ce41db050fded7
parentMerge remote branch 'refs/remotes/svn/trunk' into svn (diff)
parenttestnet and keypoololdest added to RPC getinfo output. And RPC now sends pro... (diff)
downloaddiscoin-2ea321d85ae6068b659680e914b06d8862ef66ef.tar.xz
discoin-2ea321d85ae6068b659680e914b06d8862ef66ef.zip
Merge remote branch 'refs/remotes/svn/trunk' into svn
-rw-r--r--db.cpp9
-rw-r--r--db.h1
-rw-r--r--headers.h1
-rw-r--r--main.cpp2
-rw-r--r--rpc.cpp25
-rw-r--r--serialize.h2
-rw-r--r--setup.nsi6
7 files changed, 35 insertions, 11 deletions
diff --git a/db.cpp b/db.cpp
index e606e5d79..9657cbf98 100644
--- a/db.cpp
+++ b/db.cpp
@@ -908,3 +908,12 @@ vector<unsigned char> CWalletDB::GetKeyFromKeyPool()
KeepKey(nIndex);
return keypool.vchPubKey;
}
+
+int64 CWalletDB::GetOldestKeyPoolTime()
+{
+ int64 nIndex = 0;
+ CKeyPool keypool;
+ ReserveKeyFromKeyPool(nIndex, keypool);
+ ReturnKey(nIndex);
+ return keypool.nTime;
+}
diff --git a/db.h b/db.h
index 385b898bc..3452dd89f 100644
--- a/db.h
+++ b/db.h
@@ -432,6 +432,7 @@ protected:
friend class CReserveKey;
public:
vector<unsigned char> GetKeyFromKeyPool();
+ int64 GetOldestKeyPoolTime();
};
bool LoadWallet(bool& fFirstRunRet);
diff --git a/headers.h b/headers.h
index a12392d18..6a08cb7fe 100644
--- a/headers.h
+++ b/headers.h
@@ -43,6 +43,7 @@
#include <db_cxx.h>
#include <stdio.h>
#include <stdlib.h>
+#include <time.h>
#include <math.h>
#include <limits.h>
#include <float.h>
diff --git a/main.cpp b/main.cpp
index 2d950eefb..764ddaac0 100644
--- a/main.cpp
+++ b/main.cpp
@@ -2987,7 +2987,7 @@ void BitcoinMiner()
txNew.vin.resize(1);
txNew.vin[0].prevout.SetNull();
int64 nNow = max(pindexPrev->GetMedianTimePast()+1, GetAdjustedTime());
- if (nNow > nPrevTime+1 && ++nExtraNonce >= 0x7f)
+ if (++nExtraNonce >= 0x7f && nNow > nPrevTime+1)
{
nExtraNonce = 1;
nPrevTime = nNow;
diff --git a/rpc.cpp b/rpc.cpp
index 81d36b378..ac413cf11 100644
--- a/rpc.cpp
+++ b/rpc.cpp
@@ -261,6 +261,8 @@ Value getinfo(const Array& params, bool fHelp)
obj.push_back(Pair("genproclimit", (int)(fLimitProcessors ? nLimitProcessors : -1)));
obj.push_back(Pair("difficulty", (double)GetDifficulty()));
obj.push_back(Pair("hashespersec", gethashespersec(params, false)));
+ obj.push_back(Pair("testnet", fTestNet));
+ obj.push_back(Pair("keypoololdest", (boost::int64_t)CWalletDB().GetOldestKeyPoolTime()));
obj.push_back(Pair("errors", GetWarnings("statusbar")));
return obj;
}
@@ -767,12 +769,22 @@ string HTTPPost(const string& strMsg, const map<string,string>& mapRequestHeader
return s.str();
}
+string rfc1123Time()
+{
+ char buffer[32];
+ time_t now;
+ time(&now);
+ struct tm* now_gmt = gmtime(&now);
+ strftime(buffer, sizeof(buffer), "%a, %d %b %Y %H:%M:%S %Z", now_gmt);
+ return string(buffer);
+}
+
string HTTPReply(int nStatus, const string& strMsg)
{
if (nStatus == 401)
- return "HTTP/1.0 401 Authorization Required\r\n"
- "Server: HTTPd/1.0\r\n"
- "Date: Sat, 08 Jul 2006 12:04:08 GMT\r\n"
+ return strprintf("HTTP/1.0 401 Authorization Required\r\n"
+ "Date: %s\r\n"
+ "Server: bitcoin-json-rpc\r\n"
"WWW-Authenticate: Basic realm=\"jsonrpc\"\r\n"
"Content-Type: text/html\r\n"
"Content-Length: 311\r\n"
@@ -785,7 +797,7 @@ string HTTPReply(int nStatus, const string& strMsg)
"<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=ISO-8859-1'>\r\n"
"</HEAD>\r\n"
"<BODY><H1>401 Unauthorized.</H1></BODY>\r\n"
- "</HTML>\r\n";
+ "</HTML>\r\n", rfc1123Time().c_str());
string strStatus;
if (nStatus == 200) strStatus = "OK";
else if (nStatus == 400) strStatus = "Bad Request";
@@ -793,15 +805,16 @@ string HTTPReply(int nStatus, const string& strMsg)
else if (nStatus == 500) strStatus = "Internal Server Error";
return strprintf(
"HTTP/1.1 %d %s\r\n"
+ "Date: %s\r\n"
"Connection: close\r\n"
"Content-Length: %d\r\n"
"Content-Type: application/json\r\n"
- "Date: Sat, 08 Jul 2006 12:04:08 GMT\r\n"
- "Server: json-rpc/1.0\r\n"
+ "Server: bitcoin-json-rpc/1.0\r\n"
"\r\n"
"%s",
nStatus,
strStatus.c_str(),
+ rfc1123Time().c_str(),
strMsg.size(),
strMsg.c_str());
}
diff --git a/serialize.h b/serialize.h
index 0268c750b..6b3b3b579 100644
--- a/serialize.h
+++ b/serialize.h
@@ -22,7 +22,7 @@ class CDataStream;
class CAutoFile;
static const unsigned int MAX_SIZE = 0x02000000;
-static const int VERSION = 31306;
+static const int VERSION = 31401;
static const char* pszSubVer = "";
diff --git a/setup.nsi b/setup.nsi
index 32ea5dd5b..5873b075c 100644
--- a/setup.nsi
+++ b/setup.nsi
@@ -7,7 +7,7 @@ RequestExecutionLevel highest
# General Symbol Definitions
!define REGKEY "SOFTWARE\$(^Name)"
-!define VERSION 0.3.13
+!define VERSION 0.3.14
!define COMPANY "Bitcoin project"
!define URL http://www.bitcoin.org/
@@ -42,12 +42,12 @@ Var StartMenuGroup
!insertmacro MUI_LANGUAGE English
# Installer attributes
-OutFile bitcoin-0.3.13-win32-setup.exe
+OutFile bitcoin-0.3.14-win32-setup.exe
InstallDir $PROGRAMFILES\Bitcoin
CRCCheck on
XPStyle on
ShowInstDetails show
-VIProductVersion 0.3.13.0
+VIProductVersion 0.3.14.0
VIAddVersionKey ProductName Bitcoin
VIAddVersionKey ProductVersion "${VERSION}"
VIAddVersionKey CompanyName "${COMPANY}"