common

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const HashLength = 32
View Source
const UINT160SIZE int = 20
View Source
const UINT256SIZE int = 32

Variables

This section is empty.

Functions

func BytesReverse

func BytesReverse(u []byte) []byte

func BytesToHexString

func BytesToHexString(data []byte) string

func BytesToInt

func BytesToInt(b []byte) []int

func BytesToInt16

func BytesToInt16(b []byte) int16

func ClearBytes

func ClearBytes(arr []byte, len int)

func CompareHeight

func CompareHeight(blockHeight uint64, heights []uint64) bool

func FileExisted

func FileExisted(filename string) bool

func GetCompactUint

func GetCompactUint(buf []byte) (uint64, uint8)

func GetNonce

func GetNonce() uint64

func GetUint16Array

func GetUint16Array(source []byte) ([]uint16, error)

func HexStringToBytes

func HexStringToBytes(value string) ([]byte, error)

func HexStringToBytesReverse

func HexStringToBytesReverse(value string) ([]byte, error)

func IntToBytes

func IntToBytes(n int) []byte

func IsEqualBytes

func IsEqualBytes(b1 []byte, b2 []byte) bool

func SetCompactUint

func SetCompactUint(num uint64) []byte

TODO Fix the return value to the correct number

func SliceRemove

func SliceRemove(slice []uint32, h uint32) []uint32

func ToArrayReverse

func ToArrayReverse(arr []byte) []byte

func ToByteArray

func ToByteArray(source []uint16) []byte

Types

type CompactUint

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

type Fixed64

type Fixed64 int64

the 64 bit fixed-point number, precise 10^-8

func StringToFixed64

func StringToFixed64(s string) (Fixed64, error)

func (*Fixed64) Deserialize

func (f *Fixed64) Deserialize(r io.Reader) error

func (Fixed64) GetData

func (f Fixed64) GetData() int64

func (*Fixed64) Serialize

func (f *Fixed64) Serialize(w io.Writer) error

func (Fixed64) String

func (f Fixed64) String() string

type Hash

type Hash [HashLength]byte

func BigToHash

func BigToHash(b *big.Int) Hash

func BytesToHash

func BytesToHash(b []byte) Hash

func (Hash) Big

func (h Hash) Big() (b *big.Int)

func (Hash) Bytes

func (h Hash) Bytes() []byte

func (*Hash) SetBytes

func (h *Hash) SetBytes(b []byte)

type Inventory

type Inventory interface {
	//sig.SignableData
	Hash() Uint256
	Verify() error
	Type() InventoryType
}

TODO: temp inventory

type InventoryType

type InventoryType byte
const (
	TRANSACTION InventoryType = 0x01
	BLOCK       InventoryType = 0x02
	CONSENSUS   InventoryType = 0xe0
)

type Uint160

type Uint160 [UINT160SIZE]uint8

func BigToUint160

func BigToUint160(b *big.Int) Uint160

func BytesToUint160

func BytesToUint160(b []byte) Uint160

func ToCodeHash

func ToCodeHash(code []byte) (Uint160, error)

func ToScriptHash

func ToScriptHash(address string) (Uint160, error)

func Uint160ParseFromBytes

func Uint160ParseFromBytes(f []byte) (Uint160, error)

func (*Uint160) Big

func (u *Uint160) Big() *big.Int

func (*Uint160) CompareTo

func (u *Uint160) CompareTo(o Uint160) int

func (*Uint160) Deserialize

func (f *Uint160) Deserialize(r io.Reader) error

func (*Uint160) Serialize

func (u *Uint160) Serialize(w io.Writer) (int, error)

func (*Uint160) SetBytes

func (u *Uint160) SetBytes(b []byte)

func (*Uint160) ToAddress

func (f *Uint160) ToAddress() (string, error)

func (*Uint160) ToArray

func (u *Uint160) ToArray() []byte

func (*Uint160) ToArrayReverse

func (u *Uint160) ToArrayReverse() []byte

type Uint256

type Uint256 [UINT256SIZE]uint8

func Uint256ParseFromBytes

func Uint256ParseFromBytes(f []byte) (Uint256, error)

func (*Uint256) CompareTo

func (u *Uint256) CompareTo(o Uint256) int

func (*Uint256) Deserialize

func (u *Uint256) Deserialize(r io.Reader) error

func (*Uint256) Serialize

func (u *Uint256) Serialize(w io.Writer) (int, error)

func (*Uint256) ToArray

func (u *Uint256) ToArray() []byte

func (*Uint256) ToArrayReverse

func (u *Uint256) ToArrayReverse() []byte

func (*Uint256) ToString

func (u *Uint256) ToString() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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