mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-12 01:41:36 +00:00
Merge 06c70d32fa into 6ece4cd143
This commit is contained in:
commit
6d485f1b18
4 changed files with 2 additions and 33 deletions
|
|
@ -29,7 +29,6 @@ import (
|
|||
"github.com/ethereum/go-ethereum/consensus/misc/eip4844"
|
||||
"github.com/ethereum/go-ethereum/core"
|
||||
"github.com/ethereum/go-ethereum/core/filtermaps"
|
||||
"github.com/ethereum/go-ethereum/core/history"
|
||||
"github.com/ethereum/go-ethereum/core/rawdb"
|
||||
"github.com/ethereum/go-ethereum/core/state"
|
||||
"github.com/ethereum/go-ethereum/core/txpool"
|
||||
|
|
@ -155,11 +154,7 @@ func (b *EthAPIBackend) BlockByNumber(ctx context.Context, number rpc.BlockNumbe
|
|||
if number == rpc.EarliestBlockNumber {
|
||||
bn = b.HistoryPruningCutoff()
|
||||
}
|
||||
block := b.eth.blockchain.GetBlockByNumber(bn)
|
||||
if block == nil && bn < b.HistoryPruningCutoff() {
|
||||
return nil, &history.PrunedHistoryError{}
|
||||
}
|
||||
return block, nil
|
||||
return b.eth.blockchain.GetBlockByNumber(bn), nil
|
||||
}
|
||||
|
||||
func (b *EthAPIBackend) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error) {
|
||||
|
|
@ -167,11 +162,7 @@ func (b *EthAPIBackend) BlockByHash(ctx context.Context, hash common.Hash) (*typ
|
|||
if number == nil {
|
||||
return nil, nil
|
||||
}
|
||||
block := b.eth.blockchain.GetBlock(hash, *number)
|
||||
if block == nil && *number < b.HistoryPruningCutoff() {
|
||||
return nil, &history.PrunedHistoryError{}
|
||||
}
|
||||
return block, nil
|
||||
return b.eth.blockchain.GetBlock(hash, *number), nil
|
||||
}
|
||||
|
||||
// GetBody returns body of a block. It does not resolve special block numbers.
|
||||
|
|
@ -181,9 +172,6 @@ func (b *EthAPIBackend) GetBody(ctx context.Context, hash common.Hash, number rp
|
|||
}
|
||||
body := b.eth.blockchain.GetBody(hash)
|
||||
if body == nil {
|
||||
if uint64(number) < b.HistoryPruningCutoff() {
|
||||
return nil, &history.PrunedHistoryError{}
|
||||
}
|
||||
return nil, errors.New("block body not found")
|
||||
}
|
||||
return body, nil
|
||||
|
|
@ -205,9 +193,6 @@ func (b *EthAPIBackend) BlockByNumberOrHash(ctx context.Context, blockNrOrHash r
|
|||
}
|
||||
block := b.eth.blockchain.GetBlock(hash, header.Number.Uint64())
|
||||
if block == nil {
|
||||
if header.Number.Uint64() < b.HistoryPruningCutoff() {
|
||||
return nil, &history.PrunedHistoryError{}
|
||||
}
|
||||
return nil, errors.New("header found, but block body is missing")
|
||||
}
|
||||
return block, nil
|
||||
|
|
|
|||
|
|
@ -28,7 +28,6 @@ import (
|
|||
"github.com/ethereum/go-ethereum"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||
"github.com/ethereum/go-ethereum/core/history"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/internal/ethapi"
|
||||
"github.com/ethereum/go-ethereum/rpc"
|
||||
|
|
@ -481,9 +480,6 @@ func (api *FilterAPI) GetLogs(ctx context.Context, crit FilterCriteria) ([]*type
|
|||
if begin > 0 && end > 0 && begin > end {
|
||||
return nil, errInvalidBlockRange
|
||||
}
|
||||
if begin >= 0 && begin < int64(api.events.backend.HistoryPruningCutoff()) {
|
||||
return nil, &history.PrunedHistoryError{}
|
||||
}
|
||||
// Construct the range filter
|
||||
filter = api.sys.NewRangeFilter(begin, end, crit.Addresses, crit.Topics, api.rangeLimit)
|
||||
}
|
||||
|
|
@ -536,9 +532,6 @@ func (api *FilterAPI) GetFilterLogs(ctx context.Context, id rpc.ID) ([]*types.Lo
|
|||
if f.crit.ToBlock != nil {
|
||||
end = f.crit.ToBlock.Int64()
|
||||
}
|
||||
if begin >= 0 && begin < int64(api.events.backend.HistoryPruningCutoff()) {
|
||||
return nil, &history.PrunedHistoryError{}
|
||||
}
|
||||
// Construct the range filter
|
||||
filter = api.sys.NewRangeFilter(begin, end, f.crit.Addresses, f.crit.Topics, api.rangeLimit)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,7 +27,6 @@ import (
|
|||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/core"
|
||||
"github.com/ethereum/go-ethereum/core/filtermaps"
|
||||
"github.com/ethereum/go-ethereum/core/history"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/log"
|
||||
"github.com/ethereum/go-ethereum/rpc"
|
||||
|
|
@ -90,9 +89,6 @@ func (f *Filter) Logs(ctx context.Context) ([]*types.Log, error) {
|
|||
if header == nil {
|
||||
return nil, errUnknownBlock
|
||||
}
|
||||
if header.Number.Uint64() < f.sys.backend.HistoryPruningCutoff() {
|
||||
return nil, &history.PrunedHistoryError{}
|
||||
}
|
||||
return f.blockLogs(ctx, header)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,7 +30,6 @@ import (
|
|||
"github.com/ethereum/go-ethereum/common/lru"
|
||||
"github.com/ethereum/go-ethereum/core"
|
||||
"github.com/ethereum/go-ethereum/core/filtermaps"
|
||||
"github.com/ethereum/go-ethereum/core/history"
|
||||
"github.com/ethereum/go-ethereum/core/types"
|
||||
"github.com/ethereum/go-ethereum/ethdb"
|
||||
"github.com/ethereum/go-ethereum/event"
|
||||
|
|
@ -328,10 +327,6 @@ func (es *EventSystem) SubscribeLogs(crit ethereum.FilterQuery, logs chan []*typ
|
|||
if from == rpc.EarliestBlockNumber {
|
||||
from = rpc.BlockNumber(es.backend.HistoryPruningCutoff())
|
||||
}
|
||||
// Queries beyond the pruning cutoff are not supported.
|
||||
if uint64(from) < es.backend.HistoryPruningCutoff() {
|
||||
return nil, &history.PrunedHistoryError{}
|
||||
}
|
||||
|
||||
// only interested in new mined logs
|
||||
if from == rpc.LatestBlockNumber && to == rpc.LatestBlockNumber {
|
||||
|
|
|
|||
Loading…
Reference in a new issue