feat: add header and comet info service (#15850)

Co-authored-by: Aaron Craelius <aaron@regen.network>
This commit is contained in:
Marko
2023-05-03 13:32:25 +00:00
committed by GitHub
co-authored by Aaron Craelius
parent 1d03f419f7
commit 1705615ef0
27 changed files with 659 additions and 107 deletions
+7
View File
@@ -0,0 +1,7 @@
/*
Package header defines a generalized Header type that all consensus & networking layers must provide.
If modules need access to the current block header information, like height, hash, time, or chain ID
they should use the Header Service interface.
*/
package header
+19
View File
@@ -0,0 +1,19 @@
package header
import (
"context"
"time"
)
// Service defines the interface in which you can get header information
type Service interface {
GetHeaderInfo(context.Context) Info
}
// Info defines a struct that contains information about the header
type Info struct {
Height int64 // Height returns the height of the block
Hash []byte // Hash returns the hash of the block header
Time time.Time // Time returns the time of the block
ChainID string // ChainId returns the chain ID of the block
}