diff options
author | Gavin Andresen <gavinandresen@gmail.com> | 2013-01-23 06:48:57 -0800 |
---|---|---|
committer | Gavin Andresen <gavinandresen@gmail.com> | 2013-01-23 06:48:57 -0800 |
commit | a337505bd7d0791fa1123c600ea9295cafa678b3 (patch) | |
tree | 94b7273ddcc28efb506fd3528ebc05a3096e032f /src/main.cpp | |
parent | 1a2e45d8d50d22929ab12ae68189e6171907dba5 (diff) | |
parent | 903d146030e741441c288873ef3c682fb5019101 (diff) |
Merge pull request #2192 from mikehearn/notfoundmsg
Add a notfound message to getdata.
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp index adc4ac0d25..67f05817fe 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3237,6 +3237,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) if (fDebugNet || (vInv.size() != 1)) printf("received getdata (%"PRIszu" invsz)\n", vInv.size()); + vector<CInv> vNotFound; BOOST_FOREACH(const CInv& inv, vInv) { if (fShutdown) @@ -3309,12 +3310,27 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv) ss.reserve(1000); ss << tx; pfrom->PushMessage("tx", ss); + pushed = true; } } + if (!pushed) { + vNotFound.push_back(inv); + } } - // Track requests for our stuff + // Track requests for our stuff. Inventory(inv.hash); + + if (!vNotFound.empty()) { + // Let the peer know that we didn't find what it asked for, so it doesn't + // have to wait around forever. Currently only SPV clients actually care + // about this message: it's needed when they are recursively walking the + // dependencies of relevant unconfirmed transactions. SPV clients want to + // do that because they want to know about (and store and rebroadcast and + // risk analyze) the dependencies of transactions relevant to them, without + // having to download the entire memory pool. + pfrom->PushMessage("notfound", vNotFound); + } } } |