db

package
v0.0.0-...-2fe5e27 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 4, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

This file is part of the go-ethereum library.

The go-ethereum library is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The go-ethereum library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.

Index

Constants

This section is empty.

Variables

View Source
var (
	Pool *redis.Pool
)

Functions

func NewPool

func NewPool(server string) *redis.Pool

Types

type BlockChain

type BlockChain struct {
	// contains filtered or unexported fields
}

Blockchain is an interface to be used by the devp2p downloader to abstract the Redis DB

func LoadBlockChain

func LoadBlockChain(dbPool *redis.Pool) *BlockChain

func (*BlockChain) CurrentHeader

func (b *BlockChain) CurrentHeader() *types.Header

CurrentHeader retrieves the head header from the local chain.

func (*BlockChain) GetHeaderByHash

func (b *BlockChain) GetHeaderByHash(hash common.Hash) *types.Header

GetHeaderByHash retrieves a header from the local chain.

func (*BlockChain) GetTd

func (b *BlockChain) GetTd(hash common.Hash, number uint64) *big.Int

GetTd returns the total difficulty of a local block.

func (*BlockChain) HasHeader

func (b *BlockChain) HasHeader(desiredHash common.Hash, desiredHashNumber uint64) bool

HasHeader verifies a header's presence in the local chain (i.e. CHT)

func (*BlockChain) InsertHeaderChain

func (b *BlockChain) InsertHeaderChain(headers []*types.Header, checkFreq int) (int, error)

InsertHeaderChain inserts a batch of headers into the local chain.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL