diff options
| author | Jeff Garzik <[email protected]> | 2012-10-08 15:12:25 -0700 |
|---|---|---|
| committer | Jeff Garzik <[email protected]> | 2012-10-08 15:12:25 -0700 |
| commit | 56caa38a6719e133a2f1c17275eb596ab8f1c463 (patch) | |
| tree | daf6c20dfd7187255c8f82ba7df5fa6b191ab6be /src/main.cpp | |
| parent | Merge branch 'BDB_DOWNGRADE' (diff) | |
| parent | Send 'mempool' P2P command at the start of each P2P session (diff) | |
| download | discoin-56caa38a6719e133a2f1c17275eb596ab8f1c463.tar.xz discoin-56caa38a6719e133a2f1c17275eb596ab8f1c463.zip | |
Merge pull request #1833 from jgarzik/mempool-query
Send 'mempool' P2P command at the start of each P2P session
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp index da1072970..0e22a4c36 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2404,6 +2404,14 @@ bool static AlreadyHave(CTxDB& txdb, const CInv& inv) +static bool NodeRecentlyStarted() +{ + extern int64 nTimeNodeStart; + int64 timediff = GetTime() - nTimeNodeStart; + + return (timediff < (2 * 60 * 60)); +} + // The message start string is designed to be unlikely to occur in normal data. // The characters are rarely used upper ASCII, not valid as UTF-8, and produce @@ -2510,6 +2518,12 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) } } + // Trigger download of remote node's memory pool + if (!IsInitialBlockDownload() && !pfrom->fInbound && + !pfrom->fClient && NodeRecentlyStarted() && + pfrom->nVersion >= MEMPOOL_GD_VERSION) + pfrom->PushMessage("mempool"); + // Ask the first connected node for block updates static int nAskedForBlocks = 0; if (!pfrom->fClient && !pfrom->fOneShot && |