lightninglabs / neutrino

Privacy-Preserving Bitcoin Light Client
MIT License
894 stars 182 forks source link

blockmanager.go: use btcd libs to validate headers #283

Closed guggero closed 1 year ago

guggero commented 1 year ago

Replaces https://github.com/lightninglabs/neutrino/pull/263.

This uses btcd's HeaderCtx and ChainCtx interfaces to be able to validate headers, both contextually and context-free. This allows neutrino to call blockchain.CheckBlockHeaderContext and blockchain.CheckBlockHeaderSanity. Also included is a check to assert that when neutrino receives a p2p headers message, that each header connects to the previous one.

Fixes https://github.com/lightninglabs/neutrino/issues/255

Roasbeef commented 1 year ago

Small linter error:

Error: blockmanager.go:33:2: `maxTimeOffset` is unused (deadcode)
guggero commented 1 year ago

Small linter error:

Oops, fixed.

lightninglabs-deploy commented 1 year ago

@roasbeef: review reminder @guggero, remember to re-request review from reviewers when ready