[Pkg-bitcoin-commits] [bitcoin] 85/126: Don't process unrequested, low-work blocks

Jonas Smedegaard dr at jones.dk
Mon Nov 13 20:02:33 UTC 2017


This is an automated email from the git hooks/post-receive script.

js pushed a commit to annotated tag debian/0.15.1_dfsg-1
in repository bitcoin.

commit 3acec3878133c52f4f3a594baf1dcbd6575244bb
Author: Suhas Daftuar <sdaftuar at chaincode.com>
Date:   Fri Oct 6 14:11:43 2017 -0400

    Don't process unrequested, low-work blocks
    
    A peer could try to waste our resources by sending us unrequested blocks with
    low work, eg to fill up our disk.  Since
    e2652002b6011f793185d473f87f1730c625593b we no longer request blocks until we
    know we're on a chain with more than nMinimumChainWork (our anti-DoS
    threshold), but we would still process unrequested blocks that had more work
    than our tip.  This commit fixes that behavior.
    
    Github-Pull: #11458
    Rebased-From: ce8cd7a7da9174ab151172fc0ce97b5164637cf3
---
 src/validation.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/validation.cpp b/src/validation.cpp
index 76b8401..3bff2d8 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -3120,6 +3120,12 @@ static bool AcceptBlock(const std::shared_ptr<const CBlock>& pblock, CValidation
         if (pindex->nTx != 0) return true;  // This is a previously-processed block that was pruned
         if (!fHasMoreWork) return true;     // Don't process less-work chains
         if (fTooFarAhead) return true;      // Block height is too high
+
+        // Protect against DoS attacks from low-work chains.
+        // If our tip is behind, a peer could try to send us
+        // low-work blocks on a fake chain that we would never
+        // request; don't process these.
+        if (pindex->nChainWork < nMinimumChainWork) return true;
     }
     if (fNewBlock) *fNewBlock = true;
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-bitcoin/bitcoin.git



More information about the Pkg-bitcoin-commits mailing list