Patch for concurrent iterator & others (onto v1.11.6) #386

Closed
roysc wants to merge 1565 commits from v1.11.6-statediff-v5 into master
Showing only changes of commit 3ccd6b6dbb - Show all commits

View File

@ -599,21 +599,18 @@ func (b *Block) BaseFeePerGas(ctx context.Context) (*hexutil.Big, error) {
}
func (b *Block) Parent(ctx context.Context) (*Block, error) {
// If the block header hasn't been fetched, and we'll need it, fetch it.
if b.numberOrHash == nil && b.header == nil {
if _, err := b.resolveHeader(ctx); err != nil {
return nil, err
}
if _, err := b.resolveHeader(ctx); err != nil {
return nil, err
}
if b.header != nil && b.header.Number.Uint64() > 0 {
num := rpc.BlockNumberOrHashWithNumber(rpc.BlockNumber(b.header.Number.Uint64() - 1))
return &Block{
backend: b.backend,
numberOrHash: &num,
hash: b.header.ParentHash,
}, nil
if b.header == nil || b.header.Number.Uint64() < 1 {
return nil, nil
}
return nil, nil
num := rpc.BlockNumberOrHashWithNumber(rpc.BlockNumber(b.header.Number.Uint64() - 1))
return &Block{
backend: b.backend,
numberOrHash: &num,
hash: b.header.ParentHash,
}, nil
}
func (b *Block) Difficulty(ctx context.Context) (hexutil.Big, error) {