mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
fixup
This commit is contained in:
parent
d5a0d6256e
commit
a9bc6eb4ce
1 changed files with 3 additions and 5 deletions
|
|
@ -150,17 +150,15 @@ func (b *EthAPIBackend) BlockByNumber(ctx context.Context, number rpc.BlockNumbe
|
||||||
}
|
}
|
||||||
return b.eth.blockchain.GetBlock(header.Hash(), header.Number.Uint64()), nil
|
return b.eth.blockchain.GetBlock(header.Hash(), header.Number.Uint64()), nil
|
||||||
}
|
}
|
||||||
bn := uint64(number)
|
bn := uint64(number) // the resolved number
|
||||||
if number == rpc.EarliestBlockNumber {
|
if number == rpc.EarliestBlockNumber {
|
||||||
bn = b.eth.blockchain.HistoryPruningCutoff()
|
bn = b.eth.blockchain.HistoryPruningCutoff()
|
||||||
}
|
}
|
||||||
|
|
||||||
// bn is the resolved number.
|
|
||||||
block := b.eth.blockchain.GetBlockByNumber(bn)
|
block := b.eth.blockchain.GetBlockByNumber(bn)
|
||||||
if block == nil && bn < b.eth.blockchain.HistoryPruningCutoff() {
|
if block == nil && bn < b.eth.blockchain.HistoryPruningCutoff() {
|
||||||
return nil, ðconfig.PrunedHistoryError{}
|
return nil, ðconfig.PrunedHistoryError{}
|
||||||
}
|
}
|
||||||
return nil, nil
|
return block, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *EthAPIBackend) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error) {
|
func (b *EthAPIBackend) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error) {
|
||||||
|
|
@ -172,7 +170,7 @@ func (b *EthAPIBackend) BlockByHash(ctx context.Context, hash common.Hash) (*typ
|
||||||
if block == nil && *number < b.eth.blockchain.HistoryPruningCutoff() {
|
if block == nil && *number < b.eth.blockchain.HistoryPruningCutoff() {
|
||||||
return nil, ðconfig.PrunedHistoryError{}
|
return nil, ðconfig.PrunedHistoryError{}
|
||||||
}
|
}
|
||||||
return nil, nil
|
return block, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetBody returns body of a block. It does not resolve special block numbers.
|
// GetBody returns body of a block. It does not resolve special block numbers.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue