Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: piotr_n on September 28, 2018, 03:21:25 PM



Title: NODE_NETWORK_LIMITED - what is it?
Post by: piotr_n on September 28, 2018, 03:21:25 PM
I've noticed the recent core nodes (v0.16.0 or higher) by default introduce themselves with services bit 0x400

Then I read (in src/protocol.h) this means that the node only stores the last 288 blocks..

Code:
    // NODE_NETWORK_LIMITED means the same as NODE_NETWORK with the limitation of only
    // serving the last 288 (2 day) blocks
    // See BIP159 for details on how this is implemented.
    NODE_NETWORK_LIMITED = (1 << 10),

Is it true?

Also BIP159 (https://github.com/bitcoin/bips/blob/master/bip-0159.mediawiki) says "Status: Draft" and defines NODE_NETWORK_LIMITED as:
Code:
If signaled, the peer MUST be capable of serving at least the last 288 blocks (~2 days).

So I'm a bit lost here..


Title: Re: NODE_NETWORK_LIMITED - what is it?
Post by: achow101 on September 28, 2018, 06:27:26 PM
NODE_NETWORK_LIMITED is for allowing pruned nodes to serve recent blocks. Currently, it isn't really used. However, this service bit means that the node is guaranteed to have at least the last 288 blocks. It can have more to serve, but it cannot have less.

Regarding the comment in the code, NODE_NETWORK means that a node can serve all blocks and it verifies and relays all transactions. So the comments says that NODE_NETWORK_LIMITED means the same as NODE_NETWORK by with a limitation of 288 blocks. So NODE_NETWORK_LIMITED can serve at least the 288 most recent blocks and it verifies and relays all transactions.


Title: Re: NODE_NETWORK_LIMITED - what is it?
Post by: gmaxwell on September 28, 2018, 06:55:51 PM
Then I read (in src/protocol.h) this means that the node only stores the last 288 blocks..

That isn't what it says.  Service bits state abilities, not limitations, as they can be combined logical or.

If a node says NODE_NETWORK and NODE_NETWORK_LIMITED that means it can serve the whole history (node_network) and it can serve at least the last 288 blocks (node_network_limited). So, in fact node network limited means the same as node network means but with a limit... and if you signal both you satisfy both abilities.

NODE_NETWORK_LIMITED is for allowing pruned nodes to serve recent blocks. Currently, it isn't really used.
Sure it is, it isn't turned off when pruning and https://github.com/bitcoin/bitcoin/pull/10387


Title: Re: NODE_NETWORK_LIMITED - what is it?
Post by: piotr_n on September 28, 2018, 07:08:38 PM
Ok, thanks