mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-17 10:20:44 +00:00
Revert "core/filtermaps: make ChainView thread safe (#31671)"
This reverts commit 4c9e7d1b18.
This commit is contained in:
parent
4c9e7d1b18
commit
db9687363f
1 changed files with 0 additions and 6 deletions
|
|
@ -17,8 +17,6 @@
|
||||||
package filtermaps
|
package filtermaps
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"sync"
|
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/log"
|
"github.com/ethereum/go-ethereum/log"
|
||||||
|
|
@ -41,7 +39,6 @@ type blockchain interface {
|
||||||
// of the underlying blockchain, it should only possess the block headers
|
// of the underlying blockchain, it should only possess the block headers
|
||||||
// and receipts up until the expected chain view head.
|
// and receipts up until the expected chain view head.
|
||||||
type ChainView struct {
|
type ChainView struct {
|
||||||
lock sync.Mutex
|
|
||||||
chain blockchain
|
chain blockchain
|
||||||
headNumber uint64
|
headNumber uint64
|
||||||
hashes []common.Hash // block hashes starting backwards from headNumber until first canonical hash
|
hashes []common.Hash // block hashes starting backwards from headNumber until first canonical hash
|
||||||
|
|
@ -150,9 +147,6 @@ func (cv *ChainView) extendNonCanonical() bool {
|
||||||
|
|
||||||
// blockHash returns the given block hash without doing the head number check.
|
// blockHash returns the given block hash without doing the head number check.
|
||||||
func (cv *ChainView) blockHash(number uint64) common.Hash {
|
func (cv *ChainView) blockHash(number uint64) common.Hash {
|
||||||
cv.lock.Lock()
|
|
||||||
defer cv.lock.Unlock()
|
|
||||||
|
|
||||||
if number+uint64(len(cv.hashes)) <= cv.headNumber {
|
if number+uint64(len(cv.hashes)) <= cv.headNumber {
|
||||||
hash := cv.chain.GetCanonicalHash(number)
|
hash := cv.chain.GetCanonicalHash(number)
|
||||||
if !cv.extendNonCanonical() {
|
if !cv.extendNonCanonical() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue