aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/httpserver.cpp4
-rw-r--r--src/init.cpp5
-rw-r--r--src/main.cpp15
-rw-r--r--src/net.cpp2
-rw-r--r--src/net.h1
-rw-r--r--src/protocol.h4
-rw-r--r--src/qt/bitcoingui.cpp6
-rw-r--r--src/qt/bitcoingui.h2
-rw-r--r--src/qt/walletview.cpp21
-rw-r--r--src/qt/walletview.h3
-rw-r--r--src/rest.cpp57
-rw-r--r--src/rpcnet.cpp2
-rw-r--r--src/version.h5
13 files changed, 87 insertions, 40 deletions
diff --git a/src/httpserver.cpp b/src/httpserver.cpp
index 7e599b1d78..baca007571 100644
--- a/src/httpserver.cpp
+++ b/src/httpserver.cpp
@@ -555,7 +555,7 @@ HTTPRequest::RequestMethod HTTPRequest::GetRequestMethod()
void RegisterHTTPHandler(const std::string &prefix, bool exactMatch, const HTTPRequestHandler &handler)
{
- LogPrint("http", "Registering HTTP handler for %s (exactmath %d)\n", prefix, exactMatch);
+ LogPrint("http", "Registering HTTP handler for %s (exactmatch %d)\n", prefix, exactMatch);
pathHandlers.push_back(HTTPPathHandler(prefix, exactMatch, handler));
}
@@ -568,7 +568,7 @@ void UnregisterHTTPHandler(const std::string &prefix, bool exactMatch)
break;
if (i != iend)
{
- LogPrint("http", "Unregistering HTTP handler for %s (exactmath %d)\n", prefix, exactMatch);
+ LogPrint("http", "Unregistering HTTP handler for %s (exactmatch %d)\n", prefix, exactMatch);
pathHandlers.erase(i);
}
}
diff --git a/src/init.cpp b/src/init.cpp
index 5759b4b428..a12e38ff53 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -308,7 +308,7 @@ std::string HelpMessage(HelpMessageMode mode)
#ifndef WIN32
strUsage += HelpMessageOpt("-pid=<file>", strprintf(_("Specify pid file (default: %s)"), "bitcoind.pid"));
#endif
- strUsage += HelpMessageOpt("-prune=<n>", strprintf(_("Reduce storage requirements by pruning (deleting) old blocks. This mode disables wallet support and is incompatible with -txindex. "
+ strUsage += HelpMessageOpt("-prune=<n>", strprintf(_("Reduce storage requirements by pruning (deleting) old blocks. This mode is incompatible with -txindex and -rescan. "
"Warning: Reverting this setting requires re-downloading the entire blockchain. "
"(default: 0 = disable pruning blocks, >%u = target size in MiB to use for block files)"), MIN_DISK_SPACE_FOR_BLOCK_FILES / 1024 / 1024));
strUsage += HelpMessageOpt("-reindex", _("Rebuild block chain index from current blk000??.dat files on startup"));
@@ -918,6 +918,9 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
// Option to startup with mocktime set (used for regression testing):
SetMockTime(GetArg("-mocktime", 0)); // SetMockTime(0) is a no-op
+ if (GetBoolArg("-peerbloomfilters", true))
+ nLocalServices |= NODE_BLOOM;
+
// ********************************************************* Step 4: application initialization: dir lock, daemonize, pidfile, debug log
// Initialize elliptic curve code
diff --git a/src/main.cpp b/src/main.cpp
index 35fbec6665..a880533e65 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -4591,6 +4591,21 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
}
+ else if (!(nLocalServices & NODE_BLOOM) &&
+ (strCommand == "filterload" ||
+ strCommand == "filteradd" ||
+ strCommand == "filterclear") &&
+ //TODO: Remove this line after reasonable network upgrade
+ pfrom->nVersion >= NO_BLOOM_VERSION)
+ {
+ if (pfrom->nVersion >= NO_BLOOM_VERSION)
+ Misbehaving(pfrom->GetId(), 100);
+ //TODO: Enable this after reasonable network upgrade
+ //else
+ // pfrom->fDisconnect = true;
+ }
+
+
else if (strCommand == "filterload")
{
CBloomFilter filter;
diff --git a/src/net.cpp b/src/net.cpp
index 4909d5fd40..87c4f0af0a 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -628,6 +628,7 @@ void CNode::copyStats(CNodeStats &stats)
// Raw ping time is in microseconds, but show it to user as whole seconds (Bitcoin users should be well used to small numbers with many decimal places by now :)
stats.dPingTime = (((double)nPingUsecTime) / 1e6);
+ stats.dPingMin = (((double)nMinPingUsecTime) / 1e6);
stats.dPingWait = (((double)nPingUsecWait) / 1e6);
// Leave string empty if addrLocal invalid (not filled in yet)
@@ -2260,6 +2261,7 @@ CNode::CNode(SOCKET hSocketIn, const CAddress& addrIn, const std::string& addrNa
nPingUsecStart = 0;
nPingUsecTime = 0;
fPingQueued = false;
+ nMinPingUsecTime = std::numeric_limits<int64_t>::max();
{
LOCK(cs_nLastNodeId);
diff --git a/src/net.h b/src/net.h
index f370bf1ff4..6842ee5edc 100644
--- a/src/net.h
+++ b/src/net.h
@@ -189,6 +189,7 @@ public:
bool fWhitelisted;
double dPingTime;
double dPingWait;
+ double dPingMin;
std::string addrLocal;
};
diff --git a/src/protocol.h b/src/protocol.h
index b5e65032a2..50aeaf44ba 100644
--- a/src/protocol.h
+++ b/src/protocol.h
@@ -75,6 +75,10 @@ enum {
// Bitcoin Core does not support this but a patch set called Bitcoin XT does.
// See BIP 64 for details on how this is implemented.
NODE_GETUTXO = (1 << 1),
+ // NODE_BLOOM means the node is capable and willing to handle bloom-filtered connections.
+ // Bitcoin Core nodes used to support this by default, without advertising this bit,
+ // but no longer do as of protocol version 70011 (= NO_BLOOM_VERSION)
+ NODE_BLOOM = (1 << 2),
// Bits 24-31 are reserved for temporary experiments. Just pick a bit that
// isn't getting used, or one not being used much, and notify the
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index 1d3f7762ab..db9e558764 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -97,6 +97,7 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *platformStyle, const NetworkStyle *n
trayIconMenu(0),
notificator(0),
rpcConsole(0),
+ helpMessageDialog(0),
prevBlocks(0),
spinnerFrame(0),
platformStyle(platformStyle)
@@ -132,6 +133,7 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *platformStyle, const NetworkStyle *n
#endif
rpcConsole = new RPCConsole(platformStyle, 0);
+ helpMessageDialog = new HelpMessageDialog(this, false);
#ifdef ENABLE_WALLET
if(enableWallet)
{
@@ -590,9 +592,7 @@ void BitcoinGUI::aboutClicked()
void BitcoinGUI::showHelpMessageClicked()
{
- HelpMessageDialog *help = new HelpMessageDialog(this, false);
- help->setAttribute(Qt::WA_DeleteOnClose);
- help->show();
+ helpMessageDialog->show();
}
#ifdef ENABLE_WALLET
diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h
index dd0d4bb0e2..f1b7a502ba 100644
--- a/src/qt/bitcoingui.h
+++ b/src/qt/bitcoingui.h
@@ -28,6 +28,7 @@ class SendCoinsRecipient;
class UnitDisplayStatusBarControl;
class WalletFrame;
class WalletModel;
+class HelpMessageDialog;
class CWallet;
@@ -113,6 +114,7 @@ private:
QMenu *trayIconMenu;
Notificator *notificator;
RPCConsole *rpcConsole;
+ HelpMessageDialog *helpMessageDialog;
/** Keep track of previous number of blocks, to detect progress */
int prevBlocks;
diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp
index fa96f62e03..77efdb5cdd 100644
--- a/src/qt/walletview.cpp
+++ b/src/qt/walletview.cpp
@@ -56,6 +56,9 @@ WalletView::WalletView(const PlatformStyle *platformStyle, QWidget *parent):
receiveCoinsPage = new ReceiveCoinsDialog(platformStyle);
sendCoinsPage = new SendCoinsDialog(platformStyle);
+ usedSendingAddressesPage = new AddressBookPage(platformStyle, AddressBookPage::ForEditing, AddressBookPage::SendingTab, this);
+ usedReceivingAddressesPage = new AddressBookPage(platformStyle, AddressBookPage::ForEditing, AddressBookPage::ReceivingTab, this);
+
addWidget(overviewPage);
addWidget(transactionsPage);
addWidget(receiveCoinsPage);
@@ -115,6 +118,8 @@ void WalletView::setWalletModel(WalletModel *walletModel)
overviewPage->setWalletModel(walletModel);
receiveCoinsPage->setModel(walletModel);
sendCoinsPage->setModel(walletModel);
+ usedReceivingAddressesPage->setModel(walletModel->getAddressTableModel());
+ usedSendingAddressesPage->setModel(walletModel->getAddressTableModel());
if (walletModel)
{
@@ -273,20 +278,20 @@ void WalletView::usedSendingAddresses()
{
if(!walletModel)
return;
- AddressBookPage *dlg = new AddressBookPage(platformStyle, AddressBookPage::ForEditing, AddressBookPage::SendingTab, this);
- dlg->setAttribute(Qt::WA_DeleteOnClose);
- dlg->setModel(walletModel->getAddressTableModel());
- dlg->show();
+
+ usedSendingAddressesPage->show();
+ usedSendingAddressesPage->raise();
+ usedSendingAddressesPage->activateWindow();
}
void WalletView::usedReceivingAddresses()
{
if(!walletModel)
return;
- AddressBookPage *dlg = new AddressBookPage(platformStyle, AddressBookPage::ForEditing, AddressBookPage::ReceivingTab, this);
- dlg->setAttribute(Qt::WA_DeleteOnClose);
- dlg->setModel(walletModel->getAddressTableModel());
- dlg->show();
+
+ usedReceivingAddressesPage->show();
+ usedReceivingAddressesPage->raise();
+ usedReceivingAddressesPage->activateWindow();
}
void WalletView::showProgress(const QString &title, int nProgress)
diff --git a/src/qt/walletview.h b/src/qt/walletview.h
index f97cf1ee80..2a6a6a2df2 100644
--- a/src/qt/walletview.h
+++ b/src/qt/walletview.h
@@ -18,6 +18,7 @@ class SendCoinsDialog;
class SendCoinsRecipient;
class TransactionView;
class WalletModel;
+class AddressBookPage;
QT_BEGIN_NAMESPACE
class QModelIndex;
@@ -61,6 +62,8 @@ private:
QWidget *transactionsPage;
ReceiveCoinsDialog *receiveCoinsPage;
SendCoinsDialog *sendCoinsPage;
+ AddressBookPage *usedSendingAddressesPage;
+ AddressBookPage *usedReceivingAddressesPage;
TransactionView *transactionView;
diff --git a/src/rest.cpp b/src/rest.cpp
index 9405267067..226e237fc6 100644
--- a/src/rest.cpp
+++ b/src/rest.cpp
@@ -71,15 +71,24 @@ static bool RESTERR(HTTPRequest* req, enum HTTPStatusCode status, string message
return false;
}
-static enum RetFormat ParseDataFormat(vector<string>& params, const string& strReq)
+static enum RetFormat ParseDataFormat(std::string& param, const std::string& strReq)
{
- boost::split(params, strReq, boost::is_any_of("."));
- if (params.size() > 1) {
- for (unsigned int i = 0; i < ARRAYLEN(rf_names); i++)
- if (params[1] == rf_names[i].name)
- return rf_names[i].rf;
+ const std::string::size_type pos = strReq.rfind('.');
+ if (pos == std::string::npos)
+ {
+ param = strReq;
+ return rf_names[0].rf;
}
+ param = strReq.substr(0, pos);
+ const std::string suff(strReq, pos + 1);
+
+ for (unsigned int i = 0; i < ARRAYLEN(rf_names); i++)
+ if (suff == rf_names[i].name)
+ return rf_names[i].rf;
+
+ /* If no suffix is found, return original string. */
+ param = strReq;
return rf_names[0].rf;
}
@@ -121,10 +130,10 @@ static bool rest_headers(HTTPRequest* req,
{
if (!CheckWarmup(req))
return false;
- vector<string> params;
- const RetFormat rf = ParseDataFormat(params, strURIPart);
+ std::string param;
+ const RetFormat rf = ParseDataFormat(param, strURIPart);
vector<string> path;
- boost::split(path, params[0], boost::is_any_of("/"));
+ boost::split(path, param, boost::is_any_of("/"));
if (path.size() != 2)
return RESTERR(req, HTTP_BAD_REQUEST, "No header count specified. Use /rest/headers/<count>/<hash>.<ext>.");
@@ -196,10 +205,9 @@ static bool rest_block(HTTPRequest* req,
{
if (!CheckWarmup(req))
return false;
- vector<string> params;
- const RetFormat rf = ParseDataFormat(params, strURIPart);
+ std::string hashStr;
+ const RetFormat rf = ParseDataFormat(hashStr, strURIPart);
- string hashStr = params[0];
uint256 hash;
if (!ParseHashStr(hashStr, hash))
return RESTERR(req, HTTP_BAD_REQUEST, "Invalid hash: " + hashStr);
@@ -268,8 +276,8 @@ static bool rest_chaininfo(HTTPRequest* req, const std::string& strURIPart)
{
if (!CheckWarmup(req))
return false;
- vector<string> params;
- const RetFormat rf = ParseDataFormat(params, strURIPart);
+ std::string param;
+ const RetFormat rf = ParseDataFormat(param, strURIPart);
switch (rf) {
case RF_JSON: {
@@ -293,8 +301,8 @@ static bool rest_mempool_info(HTTPRequest* req, const std::string& strURIPart)
{
if (!CheckWarmup(req))
return false;
- vector<string> params;
- const RetFormat rf = ParseDataFormat(params, strURIPart);
+ std::string param;
+ const RetFormat rf = ParseDataFormat(param, strURIPart);
switch (rf) {
case RF_JSON: {
@@ -318,8 +326,8 @@ static bool rest_mempool_contents(HTTPRequest* req, const std::string& strURIPar
{
if (!CheckWarmup(req))
return false;
- vector<string> params;
- const RetFormat rf = ParseDataFormat(params, strURIPart);
+ std::string param;
+ const RetFormat rf = ParseDataFormat(param, strURIPart);
switch (rf) {
case RF_JSON: {
@@ -343,10 +351,9 @@ static bool rest_tx(HTTPRequest* req, const std::string& strURIPart)
{
if (!CheckWarmup(req))
return false;
- vector<string> params;
- const RetFormat rf = ParseDataFormat(params, strURIPart);
+ std::string hashStr;
+ const RetFormat rf = ParseDataFormat(hashStr, strURIPart);
- string hashStr = params[0];
uint256 hash;
if (!ParseHashStr(hashStr, hash))
return RESTERR(req, HTTP_BAD_REQUEST, "Invalid hash: " + hashStr);
@@ -396,13 +403,13 @@ static bool rest_getutxos(HTTPRequest* req, const std::string& strURIPart)
{
if (!CheckWarmup(req))
return false;
- vector<string> params;
- enum RetFormat rf = ParseDataFormat(params, strURIPart);
+ std::string param;
+ const RetFormat rf = ParseDataFormat(param, strURIPart);
vector<string> uriParts;
- if (params.size() > 0 && params[0].length() > 1)
+ if (param.length() > 1)
{
- std::string strUriParams = params[0].substr(1);
+ std::string strUriParams = param.substr(1);
boost::split(uriParts, strUriParams, boost::is_any_of("/"));
}
diff --git a/src/rpcnet.cpp b/src/rpcnet.cpp
index 56ec59171d..30d0ed6270 100644
--- a/src/rpcnet.cpp
+++ b/src/rpcnet.cpp
@@ -96,6 +96,7 @@ UniValue getpeerinfo(const UniValue& params, bool fHelp)
" \"conntime\": ttt, (numeric) The connection time in seconds since epoch (Jan 1 1970 GMT)\n"
" \"timeoffset\": ttt, (numeric) The time offset in seconds\n"
" \"pingtime\": n, (numeric) ping time\n"
+ " \"minping\": n, (numeric) minimum observed ping time\n"
" \"pingwait\": n, (numeric) ping wait\n"
" \"version\": v, (numeric) The peer version, such as 7001\n"
" \"subver\": \"/Satoshi:0.8.5/\", (string) The string version\n"
@@ -139,6 +140,7 @@ UniValue getpeerinfo(const UniValue& params, bool fHelp)
obj.push_back(Pair("conntime", stats.nTimeConnected));
obj.push_back(Pair("timeoffset", stats.nTimeOffset));
obj.push_back(Pair("pingtime", stats.dPingTime));
+ obj.push_back(Pair("minping", stats.dPingMin));
if (stats.dPingWait > 0.0)
obj.push_back(Pair("pingwait", stats.dPingWait));
obj.push_back(Pair("version", stats.nVersion));
diff --git a/src/version.h b/src/version.h
index 38b3d2e734..6cdddf9255 100644
--- a/src/version.h
+++ b/src/version.h
@@ -9,7 +9,7 @@
* network protocol versioning
*/
-static const int PROTOCOL_VERSION = 70002;
+static const int PROTOCOL_VERSION = 70011;
//! initial proto version, to be increased after version/verack negotiation
static const int INIT_PROTO_VERSION = 209;
@@ -34,4 +34,7 @@ static const int BIP0031_VERSION = 60000;
//! "mempool" command, enhanced "getdata" behavior starts with this version
static const int MEMPOOL_GD_VERSION = 60002;
+//! "filter*" commands are disabled without NODE_BLOOM after and including this version
+static const int NO_BLOOM_VERSION = 70011;
+
#endif // BITCOIN_VERSION_H