Documentation ¶
Overview ¶
* Copyright (C) 2020 The poly network Authors * This file is part of The poly network library. * * The poly network 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 poly network 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 poly network . If not, see <http://www.gnu.org/licenses/>.
Index ¶
- Variables
- func CopyHeader(h *types.Header) *types.Header
- func GetNodeHeader(height uint64) ([]byte, error)
- func GetNodeHeight() (uint64, error)
- func GetProof(contractAddress string, key string, blockHeight string) ([]byte, error)
- func HeaderHash(h *types.Header) common.Hash
- func Initialize(_url string, _cli *rest.RestClient)
- func IstanbulFilteredHeader(h *types.Header, keepSeal bool) *types.Header
- func MarshalJSON(h types.Header) ([]byte, error)
- func UnmarshalJSON(h *types.Header, input []byte) error
- type IstanbulExtra
Constants ¶
This section is empty.
Variables ¶
var ( // IstanbulDigest represents a hash of "Istanbul practical byzantine fault tolerance" // to identify whether the block is from Istanbul consensus engine IstanbulDigest = common.HexToHash("0x63746963616c2062797a616e74696e65206661756c7420746f6c6572616e6365") IstanbulExtraVanity = 32 // Fixed number of extra-data bytes reserved for validator vanity IstanbulExtraSeal = 65 // Fixed number of extra-data bytes reserved for validator seal // ErrInvalidIstanbulHeaderExtra is returned if the length of extra-data is less than 32 bytes ErrInvalidIstanbulHeaderExtra = errors.New("invalid istanbul header extra-data") )
Functions ¶
func CopyHeader ¶
CopyHeader creates a deep copy of a block header to prevent side effects from modifying a header variable.
func GetNodeHeader ¶
func GetNodeHeight ¶
func HeaderHash ¶
Hash returns the block hash of the header, which is simply the keccak256 hash of its RLP encoding.
func Initialize ¶
func Initialize(_url string, _cli *rest.RestClient)
func IstanbulFilteredHeader ¶
IstanbulFilteredHeader returns a filtered header which some information (like seal, committed seals) are clean to fulfill the Istanbul hash rules. It returns nil if the extra-data cannot be decoded/encoded by rlp.
Types ¶
type IstanbulExtra ¶
func ExtractIstanbulExtra ¶
func ExtractIstanbulExtra(h *types.Header) (*IstanbulExtra, error)
ExtractIstanbulExtra extracts all values of the IstanbulExtra from the header. It returns an error if the length of the given extra-data is less than 32 bytes or the extra-data can not be decoded.