common

package
v0.0.0-...-e85cc61 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AddressLength = 20
)
View Source
const (
	HashLength = 32
)

Variables

View Source
var (
	LevelDBNotFoundError         = "leveldb: not found"
	ErrBlockKnown                = errors.New("block already known")
	ErrTransactionAlreadyPending = errors.New("this transaction is already pending transaction")
	ErrBlockTooHigh              = errors.New("block Too high")
	ErrPrevBlockMismatch         = errors.New("previous block hash of the block to be connected does not match the current block hash")
)

Functions

func GetFlag

func GetFlag(paramName string) string

func GetProjectRootPath

func GetProjectRootPath() string

func ParseFlag

func ParseFlag()

Types

type Address

type Address [AddressLength]byte

func NewAddressFromBytes

func NewAddressFromBytes(b []byte) Address

func (Address) Equal

func (a Address) Equal(address Address) bool

func (Address) String

func (a Address) String() string

func (Address) ToSlice

func (a Address) ToSlice() []byte

type Hash

type Hash [HashLength]byte

func HashFromBytes

func HashFromBytes(b []byte) Hash

func (Hash) Compare

func (h Hash) Compare(hash Hash) int

func (Hash) Equal

func (h Hash) Equal(hash Hash) bool

func (Hash) IsZero

func (h Hash) IsZero() bool

func (Hash) String

func (h Hash) String() string

func (Hash) ToSlice

func (h Hash) ToSlice() []byte

type List

type List[T any] struct {
	Data []T
}

func NewList

func NewList[T any]() *List[T]

func (*List[T]) Clear

func (l *List[T]) Clear()

func (*List[T]) Contains

func (l *List[T]) Contains(v T) bool

func (*List[T]) Get

func (l *List[T]) Get(index int) T

func (*List[T]) GetIndex

func (l *List[T]) GetIndex(v T) int

GetIndex will return the index of v. If v does not exist in the list -1 will be returned.

func (*List[T]) Insert

func (l *List[T]) Insert(v T)

func (List[T]) Last

func (l List[T]) Last() T

func (*List[T]) Len

func (l *List[T]) Len() int

func (*List[T]) Pop

func (l *List[T]) Pop(index int)

func (*List[T]) Remove

func (l *List[T]) Remove(v T)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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