Message: InsertHeaders
This message is only accessible by a whitelisted set of users. If the whitelist is empty, it is accessible by everyone.
The following parameter can be controlled by the calling user:
Headers
— This is a list of Bitcoin block headers to be added to the light client.
It is used by the relayer to add block headers to the light client. This can later be used by the staking module to verify Bitcoin transactions.
To ensure that the headers are valid, certain sanity checks are performed before they are added to the light client. These are a subset of BTC protocol rules↗.
The first set of checks are performed in the BtcValidation
AnteHandler. This validates the proof of work for the provided header. The other checks take place in the module itself when inserting the headers.
For a header to be inserted, the block with its previous block hash must already be present in the light client. In case of a fork, the light client state is rolled back. The state is updated with the new fork.