common

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2019 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Big1   = big.NewInt(1)
	Big2   = big.NewInt(2)
	Big3   = big.NewInt(3)
	Big27  = big.NewInt(27)
	Big35  = big.NewInt(35)
	Big0   = big.NewInt(0)
	Big32  = big.NewInt(32)
	Big256 = big.NewInt(0xff)
	Big257 = big.NewInt(257)
)

Common big integers often used

Functions

func AbsolutePath

func AbsolutePath(Datadir string, filename string) string

func FileExist

func FileExist(filePath string) bool

func LoadJSON

func LoadJSON(file string, val interface{}) error

LoadJSON reads the given file and unmarshals its content.

func MakeName

func MakeName(name, version string) string

MakeName creates a node name that follows the bchain convention for such names. It adds the operation system name and Go runtime version the name.

func MsgpHash

func MsgpHash(x interface{}) (h types.Hash, err error)

func PrintDepricationWarning

func PrintDepricationWarning(str string)

PrintDepricationWarning prinst the given string in a box using fmt.Println.

func Report

func Report(extra ...interface{})

Report gives off a warning requesting the user to submit an issue to the github tracker.

Types

type ChainStateReader

type ChainStateReader interface {
	BalanceAt(ctx context.Context, account types.Address, blockNumber *big.Int) (*big.Int, error)
	StorageAt(ctx context.Context, account types.Address, key types.Hash, blockNumber *big.Int) ([]byte, error)
	CodeAt(ctx context.Context, account types.Address, blockNumber *big.Int) ([]byte, error)
	NonceAt(ctx context.Context, account types.Address, blockNumber *big.Int) (uint64, error)
}

ChainStateReader wraps access to the state trie of the canonical blockchain. Note that implementations of the interface may be unable to return state values for old blocks. In many cases, using CallContract can be preferable to reading raw contract storage.

type PrettyDuration

type PrettyDuration time.Duration

PrettyDuration is a pretty printed version of a time.Duration value that cuts the unnecessary precision off from the formatted textual representation.

func (PrettyDuration) String

func (d PrettyDuration) String() string

String implements the Stringer interface, allowing pretty printing of duration values rounded to three decimals.

type Serializer

type Serializer interface {
	Serialize(w io.Writer) error
}

type StorageSize

type StorageSize float64

StorageSize is a wrapper around a float value that supports user friendly formatting.

func (StorageSize) String

func (s StorageSize) String() string

String implements the stringer interface.

func (StorageSize) TerminalString

func (s StorageSize) TerminalString() string

TerminalString implements log.TerminalStringer, formatting a string for console output during logging.

type Subscription

type Subscription interface {
	// Unsubscribe cancels the sending of events to the data channel
	// and closes the error channel.
	Unsubscribe()
	// Err returns the subscription error channel. The error channel receives
	// a value if there is an issue with the subscription (e.g. the network connection
	// delivering the events has been closed). Only one value will ever be sent.
	// The error channel is closed by Unsubscribe.
	Err() <-chan error
}

type SyncProgress

type SyncProgress struct {
	StartingBlock uint64 // Block number where sync began
	CurrentBlock  uint64 // Current block number where sync is at
	HighestBlock  uint64 // Highest alleged block number in the chain
	PulledStates  uint64 // Number of state trie entries already downloaded
	KnownStates   uint64 // Total number of state trie entries known about
}

SyncProgress gives progress indications when the node is synchronising with the Bchain network.

type UnSerializer

type UnSerializer interface {
	UnSerialize(stream interface{}) error
}

Directories

Path Synopsis
Package bitutil implements fast bitwise operations.
Package bitutil implements fast bitwise operations.
Package math provides integer math utilities.
Package math provides integer math utilities.
package mclock is a wrapper for a monotonic clock source
package mclock is a wrapper for a monotonic clock source

Jump to

Keyboard shortcuts

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