mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 19:50:36 +00:00
30 lines
494 B
Go
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
|
|
}
|