Bitcoin Forum
May 14, 2024, 08:07:58 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Block relay when pruning  (Read 852 times)
TierNolan (OP)
Legendary
*
Offline Offline

Activity: 1232
Merit: 1083


View Profile
May 27, 2015, 09:30:39 PM
 #1

I was looking at the block relay code in master.

Code:
            // Don't relay blocks if pruning -- could cause a peer to try to download, resulting
            // in a stalled download if the block file is pruned before the request.
            if (nLocalServices & NODE_NETWORK) {
                LOCK(cs_vNodes);
                BOOST_FOREACH(CNode* pnode, vNodes)
                    if (chainActive.Height() > (pnode->nStartingHeight != -1 ? pnode->nStartingHeight - 2000 : nBlockEstimate))
                        pnode->PushInventory(CInv(MSG_BLOCK, hashNewTip));
            }

When a new block is added/connected, each node informs its peers about the new block.

With this code, pruning nodes won't do that.  I don't think that is a good idea.  When in initial download, the node shouldn't inform nodes about new blocks, but once synced, there is no reason not to.

The rule could be that if the block header extends the main chain, the main chain has passed the final checkpoint (or has POW > some_threshold) and the (median of 11) timestamp for the header is less than 6 hours old then a pruning node should inform its peers about the block.  Leaving them in the dark about a new block seems worse.

1LxbG5cKXzTwZg9mjL3gaRE835uNQEteWF
1715674078
Hero Member
*
Offline Offline

Posts: 1715674078

View Profile Personal Message (Offline)

Ignore
1715674078
Reply with quote  #2

1715674078
Report to moderator
"If you don't want people to know you're a scumbag then don't be a scumbag." -- margaritahuyan
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715674078
Hero Member
*
Offline Offline

Posts: 1715674078

View Profile Personal Message (Offline)

Ignore
1715674078
Reply with quote  #2

1715674078
Report to moderator
spin
Sr. Member
****
Offline Offline

Activity: 362
Merit: 261


View Profile
May 28, 2015, 10:11:59 AM
Last edit: May 28, 2015, 12:13:11 PM by spin
 #2

I think this https://github.com/bitcoin/bitcoin/pull/5863 is where it was merged.
Under the discussion you have point 2:
Quote
We’ve disabled block relay (with a check to see if we’re NODE_NETWORK or not). In the future when we have worked out the service bit to use for an autopruned node and the behavior for block requests, we can re-enable this appropriately. (This differs from the behavior of #4701 .)
There is a litte further discussion further down as well.

So it seems the intention is to fix it once they figure out a way to tell other nodes which blocks the node has.

EDIT: Also a PR is open to fix it: https://github.com/bitcoin/bitcoin/pull/6148

If you liked this post buy me a beer.  Beers are quite cheap where I live!
bc1q707guwp9pc73r08jw23lvecpywtazjjk399daa
TierNolan (OP)
Legendary
*
Offline Offline

Activity: 1232
Merit: 1083


View Profile
May 28, 2015, 03:04:20 PM
 #3

Fair enough, and I agree with the suggest change.  There is no reason not to send invs for blocks near the tip.

1LxbG5cKXzTwZg9mjL3gaRE835uNQEteWF
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!