0

net_processing.cpp contains

    // If this set of headers is valid and ends in a block with at least as
    // much work as our tip, download as much as possible.

why are we interested in chain that's only equal in work to what we already have? would it make not better sense to download only when chain is better? what is the benefit in this <= logic compared to if it was just <?

1 Answer 1

1

When a fork exists with two equal-work branches, it is not unreasonable that the one we saw second will get extended.

There is little DoS risk in downloading both, as an attacker must spend an enormous amount of work to even make us do so.

At the same time, it is useful to be prepared for the blocks in a reorganization, as it reduces the time needed for such a block to propagate through the network.

2
  • Thank you Pieter. You say it is not unreasonable.Do you have any numbers to quantify the probability of the second block being later on longer chain? Intuitively, it seems to me that this would be a rather rare case and so I question whether it's worth to spend resources on downloading and partially checking the block. It's my intuition good or not? If it is a rare, let's say on the order of 5%, are you trying to say that the resources spent are negligible and so it is still worth?
    – Wapac
    Nov 11, 2018 at 9:28
  • The resources spent are negligable indeed, because it happens so infrequently (it's much less than 5%, closer to 0.1% in practice), and furthermore it is expensive for an attacker to raise that number (because they'd be literally wasting money to do so). Nov 11, 2018 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.