mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-24 21:56:43 +00:00
upstream v1.15.11: fixed all compilation errors
This commit is contained in:
parent
b7f304f72e
commit
1742bd3b27
15 changed files with 85 additions and 77 deletions
|
|
@ -977,6 +977,14 @@ func (fb *filterBackend) NewMatcherBackend() filtermaps.MatcherBackend {
|
|||
panic("not supported")
|
||||
}
|
||||
|
||||
func (fb *filterBackend) CurrentView() *filtermaps.ChainView {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (fb *filterBackend) HistoryPruningCutoff() uint64 {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func nullSubscription() event.Subscription {
|
||||
return event.NewSubscription(func(quit <-chan struct{}) error {
|
||||
<-quit
|
||||
|
|
|
|||
|
|
@ -331,7 +331,7 @@ func ImportHistory(chain *core.BlockChain, db ethdb.Database, dir string, networ
|
|||
if err != nil {
|
||||
return fmt.Errorf("error reading receipts %d: %w", it.Number(), err)
|
||||
}
|
||||
if status, err := chain.HeaderChain().InsertHeaderChain([]*types.Header{block.Header()}, start); err != nil {
|
||||
if status, err := chain.HeaderChain().InsertHeaderChain([]*types.Header{block.Header()}, start, forker); err != nil {
|
||||
return fmt.Errorf("error inserting header %d: %w", it.Number(), err)
|
||||
} else if status != core.CanonStatTy {
|
||||
return fmt.Errorf("error inserting header %d, not canon: %v", it.Number(), status)
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import (
|
|||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
"math/big"
|
||||
"runtime"
|
||||
"slices"
|
||||
|
|
@ -2548,8 +2547,10 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool, makeWitness
|
|||
trieDiffNodes, trieBufNodes, _ := bc.triedb.Size()
|
||||
stats.report(chain, it.index, snapDiffItems, snapBufItems, trieDiffNodes, trieBufNodes, setHead)
|
||||
|
||||
// Print confirmation that a future fork is scheduled, but not yet active.
|
||||
bc.logForkReadiness(block)
|
||||
/*
|
||||
// Print confirmation that a future fork is scheduled, but not yet active.
|
||||
bc.logForkReadiness(block)
|
||||
*/
|
||||
|
||||
if !setHead {
|
||||
// After merge we expect few side chains. Simply count
|
||||
|
|
@ -3295,6 +3296,7 @@ func (bc *BlockChain) reportBlock(block *types.Block, res *ProcessResult, err er
|
|||
log.Error(summarizeBadBlock(block, receipts, bc.Config(), err))
|
||||
}
|
||||
|
||||
/*
|
||||
// logForkReadiness will write a log when a future fork is scheduled, but not
|
||||
// active. This is useful so operators know their client is ready for the fork.
|
||||
func (bc *BlockChain) logForkReadiness(block *types.Block) {
|
||||
|
|
@ -3311,6 +3313,7 @@ func (bc *BlockChain) logForkReadiness(block *types.Block) {
|
|||
bc.lastForkReadyAlert = time.Now()
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// summarizeBadBlock returns a string summarizing the bad block and other
|
||||
// relevant information.
|
||||
|
|
@ -3388,9 +3391,3 @@ func (bc *BlockChain) GetTrieFlushInterval() time.Duration {
|
|||
func (bc *BlockChain) SubscribeChain2HeadEvent(ch chan<- Chain2HeadEvent) event.Subscription {
|
||||
return bc.scope.Track(bc.chain2HeadFeed.Subscribe(ch))
|
||||
}
|
||||
|
||||
// HistoryPruningCutoff returns the configured history pruning point.
|
||||
// Blocks before this might not be available in the database.
|
||||
func (bc *BlockChain) HistoryPruningCutoff() uint64 {
|
||||
return bc.cacheConfig.HistoryPruningCutoff
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2125,13 +2125,13 @@ func testInsertReceiptChainRollback(t *testing.T, scheme string) {
|
|||
}
|
||||
|
||||
// Set up a BlockChain that uses the ancient store.
|
||||
ancientDb, err := rawdb.NewDatabaseWithFreezer(rawdb.NewMemoryDatabase(), "", "", false)
|
||||
ancientDb, err := rawdb.NewDatabaseWithFreezer(rawdb.NewMemoryDatabase(), "", "", false, false, false)
|
||||
if err != nil {
|
||||
t.Fatalf("failed to create temp freezer db: %v", err)
|
||||
}
|
||||
defer ancientDb.Close()
|
||||
|
||||
ancientChain, _ := NewBlockChain(ancientDb, DefaultCacheConfigWithScheme(scheme), gspec, nil, ethash.NewFaker(), vm.Config{}, nil)
|
||||
ancientChain, _ := NewBlockChain(ancientDb, DefaultCacheConfigWithScheme(scheme), gspec, nil, ethash.NewFaker(), vm.Config{}, nil, nil, nil)
|
||||
defer ancientChain.Stop()
|
||||
|
||||
// Import the canonical header chain.
|
||||
|
|
|
|||
|
|
@ -68,13 +68,13 @@ type txIndexer struct {
|
|||
|
||||
// newTxIndexer initializes the transaction indexer.
|
||||
func newTxIndexer(limit uint64, chain *BlockChain) *txIndexer {
|
||||
cutoff, _ := chain.HistoryPruningCutoff()
|
||||
indexer := &txIndexer{
|
||||
limit: limit,
|
||||
cutoff: chain.HistoryPruningCutoff(),
|
||||
db: chain.db,
|
||||
progress: make(chan chan TxIndexProgress),
|
||||
term: make(chan chan struct{}),
|
||||
closed: make(chan struct{}),
|
||||
limit: limit,
|
||||
cutoff: cutoff,
|
||||
db: chain.db,
|
||||
term: make(chan chan struct{}),
|
||||
closed: make(chan struct{}),
|
||||
}
|
||||
indexer.head.Store(indexer.resolveHead())
|
||||
indexer.tail.Store(rawdb.ReadTxIndexTail(chain.db))
|
||||
|
|
|
|||
|
|
@ -218,10 +218,6 @@ func (r *reserver) Has(address common.Address) bool {
|
|||
return exists
|
||||
}
|
||||
|
||||
func MakeAddressReserver() {
|
||||
makeAddressReserver()
|
||||
}
|
||||
|
||||
// makeTx is a utility method to construct a random blob transaction and sign it
|
||||
// with a valid key, only setting the interesting fields from the perspective of
|
||||
// the blob pool.
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ func initBackend(withLocal bool) *EthAPIBackend {
|
|||
db = rawdb.NewMemoryDatabase()
|
||||
engine = beacon.New(ethash.NewFaker())
|
||||
)
|
||||
chain, _ := core.NewBlockChain(db, nil, gspec, nil, engine, vm.Config{}, nil)
|
||||
chain, _ := core.NewBlockChain(db, nil, gspec, nil, engine, vm.Config{}, nil, nil, nil)
|
||||
|
||||
txconfig := legacypool.DefaultConfig
|
||||
txconfig.Journal = "" // Don't litter the disk with test journals
|
||||
|
|
|
|||
|
|
@ -227,18 +227,17 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
|||
EnablePreimageRecording: config.EnablePreimageRecording,
|
||||
}
|
||||
cacheConfig = &core.CacheConfig{
|
||||
TrieCleanLimit: config.TrieCleanCache,
|
||||
TrieCleanNoPrefetch: config.NoPrefetch,
|
||||
TrieDirtyLimit: config.TrieDirtyCache,
|
||||
TrieDirtyDisabled: config.NoPruning,
|
||||
TrieTimeLimit: config.TrieTimeout,
|
||||
SnapshotLimit: config.SnapshotCache,
|
||||
Preimages: config.Preimages,
|
||||
StateHistory: config.StateHistory,
|
||||
StateScheme: scheme,
|
||||
TriesInMemory: config.TriesInMemory,
|
||||
ChainHistoryMode: config.HistoryMode,
|
||||
HistoryPruningCutoff: historyPruningCutoff,
|
||||
TrieCleanLimit: config.TrieCleanCache,
|
||||
TrieCleanNoPrefetch: config.NoPrefetch,
|
||||
TrieDirtyLimit: config.TrieDirtyCache,
|
||||
TrieDirtyDisabled: config.NoPruning,
|
||||
TrieTimeLimit: config.TrieTimeout,
|
||||
SnapshotLimit: config.SnapshotCache,
|
||||
Preimages: config.Preimages,
|
||||
StateHistory: config.StateHistory,
|
||||
StateScheme: scheme,
|
||||
TriesInMemory: config.TriesInMemory,
|
||||
ChainHistoryMode: config.HistoryMode,
|
||||
}
|
||||
)
|
||||
|
||||
|
|
@ -296,7 +295,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
|||
HashScheme: scheme == rawdb.HashScheme,
|
||||
}
|
||||
chainView := eth.newChainView(eth.blockchain.CurrentBlock())
|
||||
historyCutoff := eth.blockchain.HistoryPruningCutoff()
|
||||
historyCutoff, _ := eth.blockchain.HistoryPruningCutoff()
|
||||
var finalBlock uint64
|
||||
if fb := eth.blockchain.CurrentFinalBlock(); fb != nil {
|
||||
finalBlock = fb.Number.Uint64()
|
||||
|
|
@ -867,7 +866,7 @@ func (s *Ethereum) updateFilterMapsHeads() {
|
|||
if head == nil || newHead.Hash() != head.Hash() {
|
||||
head = newHead
|
||||
chainView := s.newChainView(head)
|
||||
historyCutoff := s.blockchain.HistoryPruningCutoff()
|
||||
historyCutoff, _ := s.blockchain.HistoryPruningCutoff()
|
||||
var finalBlock uint64
|
||||
if fb := s.blockchain.CurrentFinalBlock(); fb != nil {
|
||||
finalBlock = fb.Number.Uint64()
|
||||
|
|
|
|||
|
|
@ -436,8 +436,6 @@ func (q *queue) stats() []interface{} {
|
|||
}
|
||||
}
|
||||
|
||||
// This was removed from geth
|
||||
/*
|
||||
// ReserveHeaders reserves a set of headers for the given peer, skipping any
|
||||
// previously failed batches.
|
||||
func (q *queue) ReserveHeaders(p *peerConnection, count int) *fetchRequest {
|
||||
|
|
@ -480,7 +478,6 @@ func (q *queue) ReserveHeaders(p *peerConnection, count int) *fetchRequest {
|
|||
|
||||
return request
|
||||
}
|
||||
*/
|
||||
|
||||
// ReserveBodies reserves a set of body fetches for the given peer, skipping any
|
||||
// previously failed downloads. Beside the next batch of needed fetches, it also
|
||||
|
|
@ -644,8 +641,6 @@ func (q *queue) Revoke(peerID string) {
|
|||
}
|
||||
}
|
||||
|
||||
// This was removed from geth
|
||||
/*
|
||||
// ExpireHeaders cancels a request that timed out and moves the pending fetch
|
||||
// task back into the queue for rescheduling.
|
||||
func (q *queue) ExpireHeaders(peer string) int {
|
||||
|
|
@ -656,7 +651,6 @@ func (q *queue) ExpireHeaders(peer string) int {
|
|||
|
||||
return q.expire(peer, q.headerPendPool, q.headerTaskQueue)
|
||||
}
|
||||
*/
|
||||
|
||||
// ExpireBodies checks for in flight block body requests that exceeded a timeout
|
||||
// allowance, canceling them and returning the responsible peers for penalisation.
|
||||
|
|
@ -711,8 +705,6 @@ func (q *queue) expire(peer string, pendPool map[string]*fetchRequest, taskQueue
|
|||
return len(req.Headers)
|
||||
}
|
||||
|
||||
// This was removed from geth
|
||||
/*
|
||||
// DeliverHeaders injects a header retrieval response into the header results
|
||||
// cache. This method either accepts all headers it received, or none of them
|
||||
// if they do not map correctly to the skeleton.
|
||||
|
|
@ -836,7 +828,6 @@ func (q *queue) DeliverHeaders(id string, headers []*types.Header, hashes []comm
|
|||
|
||||
return len(headers), nil
|
||||
}
|
||||
*/
|
||||
|
||||
// DeliverBodies injects a block body retrieval response into the results queue.
|
||||
// The method returns the number of blocks bodies accepted from the delivery and
|
||||
|
|
|
|||
|
|
@ -10,10 +10,10 @@ import (
|
|||
|
||||
common "github.com/ethereum/go-ethereum/common"
|
||||
core "github.com/ethereum/go-ethereum/core"
|
||||
filtermaps "github.com/ethereum/go-ethereum/core/filtermaps"
|
||||
types "github.com/ethereum/go-ethereum/core/types"
|
||||
ethdb "github.com/ethereum/go-ethereum/ethdb"
|
||||
event "github.com/ethereum/go-ethereum/event"
|
||||
"github.com/ethereum/go-ethereum/core/filtermaps"
|
||||
params "github.com/ethereum/go-ethereum/params"
|
||||
rpc "github.com/ethereum/go-ethereum/rpc"
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
|
|
@ -42,21 +42,6 @@ func (m *MockBackend) EXPECT() *MockBackendMockRecorder {
|
|||
return m.recorder
|
||||
}
|
||||
|
||||
// BloomStatus mocks base method.
|
||||
func (m *MockBackend) BloomStatus() (uint64, uint64) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "BloomStatus")
|
||||
ret0, _ := ret[0].(uint64)
|
||||
ret1, _ := ret[1].(uint64)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// BloomStatus indicates an expected call of BloomStatus.
|
||||
func (mr *MockBackendMockRecorder) BloomStatus() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BloomStatus", reflect.TypeOf((*MockBackend)(nil).BloomStatus))
|
||||
}
|
||||
|
||||
// ChainConfig mocks base method.
|
||||
func (m *MockBackend) ChainConfig() *params.ChainConfig {
|
||||
m.ctrl.T.Helper()
|
||||
|
|
@ -99,6 +84,20 @@ func (mr *MockBackendMockRecorder) CurrentHeader() *gomock.Call {
|
|||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CurrentHeader", reflect.TypeOf((*MockBackend)(nil).CurrentHeader))
|
||||
}
|
||||
|
||||
// CurrentView mocks base method.
|
||||
func (m *MockBackend) CurrentView() *filtermaps.ChainView {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "CurrentView")
|
||||
ret0, _ := ret[0].(*filtermaps.ChainView)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// CurrentView indicates an expected call of CurrentView.
|
||||
func (mr *MockBackendMockRecorder) CurrentView() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CurrentView", reflect.TypeOf((*MockBackend)(nil).CurrentView))
|
||||
}
|
||||
|
||||
// GetBody mocks base method.
|
||||
func (m *MockBackend) GetBody(arg0 context.Context, arg1 common.Hash, arg2 rpc.BlockNumber) (*types.Body, error) {
|
||||
m.ctrl.T.Helper()
|
||||
|
|
@ -204,6 +203,33 @@ func (mr *MockBackendMockRecorder) HeaderByNumber(arg0, arg1 interface{}) *gomoc
|
|||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HeaderByNumber", reflect.TypeOf((*MockBackend)(nil).HeaderByNumber), arg0, arg1)
|
||||
}
|
||||
|
||||
// HistoryPruningCutoff mocks base method.
|
||||
func (m *MockBackend) HistoryPruningCutoff() uint64 {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "HistoryPruningCutoff")
|
||||
ret0, _ := ret[0].(uint64)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// HistoryPruningCutoff indicates an expected call of HistoryPruningCutoff.
|
||||
func (mr *MockBackendMockRecorder) HistoryPruningCutoff() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HistoryPruningCutoff", reflect.TypeOf((*MockBackend)(nil).HistoryPruningCutoff))
|
||||
}
|
||||
|
||||
// NewMatcherBackend mocks base method.
|
||||
func (m *MockBackend) NewMatcherBackend() filtermaps.MatcherBackend {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "NewMatcherBackend")
|
||||
ret0, _ := ret[0].(filtermaps.MatcherBackend)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// NewMatcherBackend indicates an expected call of NewMatcherBackend.
|
||||
func (mr *MockBackendMockRecorder) NewMatcherBackend() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewMatcherBackend", reflect.TypeOf((*MockBackend)(nil).NewMatcherBackend))
|
||||
}
|
||||
|
||||
// SubscribeChainEvent mocks base method.
|
||||
func (m *MockBackend) SubscribeChainEvent(arg0 chan<- core.ChainEvent) event.Subscription {
|
||||
|
|
@ -288,11 +314,3 @@ func (mr *MockBackendMockRecorder) SubscribeStateSyncEvent(arg0 interface{}) *go
|
|||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubscribeStateSyncEvent", reflect.TypeOf((*MockBackend)(nil).SubscribeStateSyncEvent), arg0)
|
||||
}
|
||||
|
||||
func (m *MockBackend) NewMatcherBackend() filtermaps.MatcherBackend {
|
||||
panic("implement me")
|
||||
}
|
||||
|
||||
func (mr *MockBackendMockRecorder) NewMatcherBackend() filtermaps.MatcherBackend {
|
||||
panic("implement me")
|
||||
}
|
||||
|
|
@ -120,7 +120,7 @@ func (m *MockFullNodeBackend) Stats() (pending int, queued int) {
|
|||
return 0, 0
|
||||
}
|
||||
|
||||
func (m *MockFullNodeBackend) SyncProgress() ethereum.SyncProgress {
|
||||
func (m *MockFullNodeBackend) SyncProgress(ctx context.Context) ethereum.SyncProgress {
|
||||
return ethereum.SyncProgress{}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,10 +80,7 @@ func blockToProtoBlock(h *types.Block) *protobor.Block {
|
|||
}
|
||||
|
||||
func (s *Server) TransactionReceipt(ctx context.Context, req *protobor.ReceiptRequest) (*protobor.ReceiptResponse, error) {
|
||||
_, _, blockHash, _, txnIndex, err := s.backend.APIBackend.GetTransaction(ctx, protoutil.ConvertH256ToHash(req.Hash))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
_, _, blockHash, _, txnIndex := s.backend.APIBackend.GetTransaction(protoutil.ConvertH256ToHash(req.Hash))
|
||||
|
||||
receipts, err := s.backend.APIBackend.GetReceipts(ctx, blockHash)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ func (s *Server) Status(ctx context.Context, in *proto.StatusRequest) (*proto.St
|
|||
}
|
||||
|
||||
apiBackend := s.backend.APIBackend
|
||||
syncProgress := apiBackend.SyncProgress()
|
||||
syncProgress := apiBackend.SyncProgress(ctx)
|
||||
|
||||
resp := &proto.StatusResponse{
|
||||
CurrentHeader: headerToProtoHeader(apiBackend.CurrentHeader()),
|
||||
|
|
|
|||
|
|
@ -716,7 +716,7 @@ func (b testBackend) SubscribePendingLogsEvent(ch chan<- []*types.Log) event.Sub
|
|||
}
|
||||
|
||||
func (b testBackend) HistoryPruningCutoff() uint64 {
|
||||
bn := b.chain.HistoryPruningCutoff()
|
||||
bn, _ := b.chain.HistoryPruningCutoff()
|
||||
return bn
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1384,6 +1384,7 @@ func (c *ChainConfig) LatestFork(time uint64) forks.Fork {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
// Timestamp returns the timestamp associated with the fork or returns nil if
|
||||
// the fork isn't defined or isn't a time-based fork.
|
||||
func (c *ChainConfig) Timestamp(fork forks.Fork) *uint64 {
|
||||
|
|
@ -1400,6 +1401,7 @@ func (c *ChainConfig) Timestamp(fork forks.Fork) *uint64 {
|
|||
return nil
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// isForkBlockIncompatible returns true if a fork scheduled at block s1 cannot be
|
||||
// rescheduled to block s2 because head is already past the fork.
|
||||
|
|
|
|||
Loading…
Reference in a new issue