ethereum/trinity

NewBlock component propagates received blocks incorrectly

njgheorghita opened this issue · 5 comments

What is wrong?

According to the devp2p spec, a NewBlock message should be propagated after receiving a NewBlock message. Currently, the NewBlockService propagates a BlockHeadersV65 command after validating an inbound block.

How can it be fixed

Update NewBlockService. _broadcast_imported_block() to propagate the right command.

Also worth noting that for blocks mined locally, we currently send just a NewBlockHashes msg to each of our peers, whereas geth first sends a NewBlock to a subset of the peers and then a NewBlockHashes to each of them: https://github.com/ethereum/go-ethereum/blob/43c278cdf93d5469702fd1c2f570dbf3c1718ff0/eth/handler.go

Oh, and NewBlockComponent doesn't actually send any NewBlockHashes msg over the wire as it emits a NewBlockHashesEvent, which is the event use to notify of a newly received msg and not the one to cause the PeerPoolEventServer to send a msg

I need those fixes to test the witness propagation, so will take care of them

@gsalgado did you still need these fixes? I'm back from time off, and can pick them up but don't want to duplicate work if you've already made progress on this

I have a fix for this in #2081 already, will move that into a separate PR soon