2023-07-10 17:22:03 +00:00
|
|
|
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()
|
2023-08-11 18:30:02 +00:00
|
|
|
s.block = block
|
2023-07-10 17:22:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *LatestBlockBuiltStore) BlockBuilt() *types.Block {
|
|
|
|
s.lock.Lock()
|
|
|
|
defer s.lock.Unlock()
|
2023-08-11 18:30:02 +00:00
|
|
|
return s.block
|
2023-07-10 17:22:03 +00:00
|
|
|
}
|