quorum

package
v0.0.0-...-c6caad8 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: GPL-3.0 Imports: 13 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
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

func CopyHeader(h *types.Header) *types.Header

CopyHeader creates a deep copy of a block header to prevent side effects from modifying a header variable.

func GetNodeHeader

func GetNodeHeader(height uint64) ([]byte, error)

func GetNodeHeight

func GetNodeHeight() (uint64, error)

func GetProof

func GetProof(contractAddress string, key string, blockHeight string) ([]byte, error)

func HeaderHash

func HeaderHash(h *types.Header) common.Hash

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

func IstanbulFilteredHeader(h *types.Header, keepSeal bool) *types.Header

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.

func MarshalJSON

func MarshalJSON(h types.Header) ([]byte, error)

MarshalJSON marshals as JSON.

func UnmarshalJSON

func UnmarshalJSON(h *types.Header, input []byte) error

UnmarshalJSON unmarshals from JSON.

Types

type IstanbulExtra

type IstanbulExtra struct {
	Validators    []common.Address
	Seal          []byte
	CommittedSeal [][]byte
}

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.

func (*IstanbulExtra) DecodeRLP

func (ist *IstanbulExtra) DecodeRLP(s *rlp.Stream) error

DecodeRLP implements rlp.Decoder, and load the istanbul fields from a RLP stream.

func (*IstanbulExtra) EncodeRLP

func (ist *IstanbulExtra) EncodeRLP(w io.Writer) error

EncodeRLP serializes ist into the Ethereum RLP format.

Jump to

Keyboard shortcuts

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