erigon-pulse/turbo/builder/latest_block_built.go
2023-08-11 20:30:02 +02:00

30 lines
494 B
Go

package builder
import (
"sync"
"github.com/ledgerwatch/erigon/core/types"
)
type LatestBlockBuiltStore struct {
block *types.Block
lock sync.Mutex
}
func NewLatestBlockBuiltStore() *LatestBlockBuiltStore {
return &LatestBlockBuiltStore{}
}
func (s *LatestBlockBuiltStore) AddBlockBuilt(block *types.Block) {
s.lock.Lock()
defer s.lock.Unlock()
s.block = block
}
func (s *LatestBlockBuiltStore) BlockBuilt() *types.Block {
s.lock.Lock()
defer s.lock.Unlock()
return s.block
}