accounter

package
v0.0.0-...-bc7c564 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2020 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ColferSizeMax is the upper limit for serial byte sizes.
	ColferSizeMax = 1024 * 1024 * 1024
	// ColferListMax is the upper limit for the number of elements in a list.
	ColferListMax = 1024 * 1024
)

Colfer configuration attributes

Functions

This section is empty.

Types

type Account

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

func NewAccount

func NewAccount(number uint32, publicKey *crypto.Public, balance uint64, updatedIndex uint32, operationsCount uint32, operationsTotal uint32, timestamp uint32) Account

func (*Account) FromPod

func (a *Account) FromPod(pod AccountPod)

func (*Account) GetBalance

func (this *Account) GetBalance() uint64

func (*Account) GetHashBuffer

func (this *Account) GetHashBuffer() AccountHashBuffer

func (*Account) GetNumber

func (this *Account) GetNumber() uint32

func (*Account) GetOperationsCount

func (this *Account) GetOperationsCount() uint32

func (*Account) GetOperationsTotal

func (this *Account) GetOperationsTotal() uint32

func (*Account) GetPublicKey

func (a *Account) GetPublicKey() *crypto.Public

func (*Account) GetPublicKeySerialized

func (this *Account) GetPublicKeySerialized() crypto.PublicSerialized

func (*Account) GetTimestamp

func (this *Account) GetTimestamp() uint32

func (*Account) GetUpdatedIndex

func (this *Account) GetUpdatedIndex() uint32

func (*Account) IsPublicKeyEqual

func (this *Account) IsPublicKeyEqual(other *crypto.Public) bool

func (*Account) Marshal

func (this *Account) Marshal() ([]byte, error)

func (*Account) Pod

func (this *Account) Pod() *AccountPod

func (*Account) Unmarshal

func (this *Account) Unmarshal(data []byte) (int, error)

type AccountHashBuffer

type AccountHashBuffer struct {
	Number       uint32
	PublicKey    crypto.Public
	Balance      uint64
	UpdatedIndex uint32
	Operations   uint32
}

type AccountPod

type AccountPod struct {
	Number uint32

	PublicKey *PublicPod

	Balance uint64

	UpdatedIndex uint32

	Operations uint32

	OperationsTotal uint32

	Timestamp uint32
}

func (*AccountPod) MarshalBinary

func (o *AccountPod) MarshalBinary() (data []byte, err error)

MarshalBinary encodes o as Colfer conform encoding.BinaryMarshaler. The error return option is accounter.ColferMax.

func (*AccountPod) MarshalLen

func (o *AccountPod) MarshalLen() (int, error)

MarshalLen returns the Colfer serial byte size. The error return option is accounter.ColferMax.

func (*AccountPod) MarshalTo

func (o *AccountPod) MarshalTo(buf []byte) int

MarshalTo encodes o as Colfer into buf and returns the number of bytes written. If the buffer is too small, MarshalTo will panic.

func (*AccountPod) Unmarshal

func (o *AccountPod) Unmarshal(data []byte) (int, error)

Unmarshal decodes data as Colfer and returns the number of bytes read. The error return options are io.EOF, accounter.ColferError and accounter.ColferMax.

func (*AccountPod) UnmarshalBinary

func (o *AccountPod) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes data as Colfer conform encoding.BinaryUnmarshaler. The error return options are io.EOF, accounter.ColferError, accounter.ColferTail and accounter.ColferMax.

type Accounter

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

func NewAccounter

func NewAccounter() *Accounter

func (*Accounter) AppendPack

func (this *Accounter) AppendPack(pack *PackBase)

func (*Accounter) BalanceAdd

func (this *Accounter) BalanceAdd(number uint32, amount uint64, index uint32)

func (*Accounter) BalanceSub

func (this *Accounter) BalanceSub(number uint32, amount uint64, index uint32)

func (*Accounter) GetAccount

func (this *Accounter) GetAccount(number uint32) *Account

func (*Accounter) GetAccountPackSerialized

func (this *Accounter) GetAccountPackSerialized(index uint32) ([]byte, error)

func (*Accounter) GetCumulativeDifficultyAndTimestamp

func (this *Accounter) GetCumulativeDifficultyAndTimestamp(index uint32) (*big.Int, uint32)

func (*Accounter) GetHeight

func (this *Accounter) GetHeight() uint32

func (*Accounter) GetState

func (this *Accounter) GetState() (uint32, []byte, *big.Int)

func (*Accounter) GetUpdatedPacks

func (a *Accounter) GetUpdatedPacks() []uint32

func (*Accounter) KeyChange

func (this *Accounter) KeyChange(number uint32, key *crypto.Public, index uint32, fee uint64)

func (*Accounter) Marshal

func (a *Accounter) Marshal() ([]byte, error)

func (*Accounter) Merge

func (a *Accounter) Merge()

func (*Accounter) NewPack

func (this *Accounter) NewPack(miner *crypto.Public, reward uint64, timestamp uint32, difficulty *big.Int) uint32

func (*Accounter) Rollback

func (a *Accounter) Rollback()

func (*Accounter) ToBlob

func (this *Accounter) ToBlob() []byte

func (*Accounter) Unmarshal

func (a *Accounter) Unmarshal(data []byte) (int, error)

type AccounterPod

type AccounterPod struct {
	Packs []*PackPod
}

func (*AccounterPod) MarshalBinary

func (o *AccounterPod) MarshalBinary() (data []byte, err error)

MarshalBinary encodes o as Colfer conform encoding.BinaryMarshaler. All nil entries in o.Packs will be replaced with a new value. The error return option is accounter.ColferMax.

func (*AccounterPod) MarshalLen

func (o *AccounterPod) MarshalLen() (int, error)

MarshalLen returns the Colfer serial byte size. The error return option is accounter.ColferMax.

func (*AccounterPod) MarshalTo

func (o *AccounterPod) MarshalTo(buf []byte) int

MarshalTo encodes o as Colfer into buf and returns the number of bytes written. If the buffer is too small, MarshalTo will panic. All nil entries in o.Packs will be replaced with a new value.

func (*AccounterPod) Unmarshal

func (o *AccounterPod) Unmarshal(data []byte) (int, error)

Unmarshal decodes data as Colfer and returns the number of bytes read. The error return options are io.EOF, accounter.ColferError and accounter.ColferMax.

func (*AccounterPod) UnmarshalBinary

func (o *AccounterPod) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes data as Colfer conform encoding.BinaryUnmarshaler. The error return options are io.EOF, accounter.ColferError, accounter.ColferTail and accounter.ColferMax.

type ColferError

type ColferError int

ColferError signals a data mismatch as as a byte index.

func (ColferError) Error

func (i ColferError) Error() string

Error honors the error interface.

type ColferMax

type ColferMax string

ColferMax signals an upper limit breach.

func (ColferMax) Error

func (m ColferMax) Error() string

Error honors the error interface.

type ColferTail

type ColferTail int

ColferTail signals data continuation as a byte index.

func (ColferTail) Error

func (i ColferTail) Error() string

Error honors the error interface.

type PackBase

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

func NewPack

func NewPack(index uint32, miner *crypto.Public, reward uint64, timestamp uint32, cumulativeDifficulty *big.Int) *PackBase

func NewPackWithAccounts

func NewPackWithAccounts(index uint32, accounts []Account, cumulativeDifficulty *big.Int) *PackBase

func (*PackBase) BalanceAdd

func (this *PackBase) BalanceAdd(offset uint32, amount uint64, index uint32)

func (*PackBase) BalanceSub

func (this *PackBase) BalanceSub(offset uint32, amount uint64, index uint32)

func (*PackBase) Copy

func (p *PackBase) Copy() *PackBase

func (*PackBase) FromPod

func (p *PackBase) FromPod(pod PackPod)

func (*PackBase) GetAccount

func (this *PackBase) GetAccount(offset int) *Account

func (*PackBase) GetCumulativeDifficulty

func (this *PackBase) GetCumulativeDifficulty() *big.Int

func (*PackBase) GetHash

func (this *PackBase) GetHash() []byte

func (*PackBase) GetIndex

func (this *PackBase) GetIndex() uint32

func (*PackBase) KeyChange

func (this *PackBase) KeyChange(offset uint32, key *crypto.Public, index uint32, fee uint64)

func (*PackBase) Marshal

func (p *PackBase) Marshal() ([]byte, error)

func (*PackBase) Pod

func (this *PackBase) Pod() *PackPod

func (*PackBase) ToBlob

func (this *PackBase) ToBlob() []byte

func (*PackBase) Unmarshal

func (p *PackBase) Unmarshal(data []byte) (int, error)

type PackPod

type PackPod struct {
	Accounts []*AccountPod

	CumulativeDifficulty []byte

	Dirty bool

	Hash []byte

	Index uint32
}

func (*PackPod) MarshalBinary

func (o *PackPod) MarshalBinary() (data []byte, err error)

MarshalBinary encodes o as Colfer conform encoding.BinaryMarshaler. All nil entries in o.Accounts will be replaced with a new value. The error return option is accounter.ColferMax.

func (*PackPod) MarshalLen

func (o *PackPod) MarshalLen() (int, error)

MarshalLen returns the Colfer serial byte size. The error return option is accounter.ColferMax.

func (*PackPod) MarshalTo

func (o *PackPod) MarshalTo(buf []byte) int

MarshalTo encodes o as Colfer into buf and returns the number of bytes written. If the buffer is too small, MarshalTo will panic. All nil entries in o.Accounts will be replaced with a new value.

func (*PackPod) Unmarshal

func (o *PackPod) Unmarshal(data []byte) (int, error)

Unmarshal decodes data as Colfer and returns the number of bytes read. The error return options are io.EOF, accounter.ColferError and accounter.ColferMax.

func (*PackPod) UnmarshalBinary

func (o *PackPod) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes data as Colfer conform encoding.BinaryUnmarshaler. The error return options are io.EOF, accounter.ColferError, accounter.ColferTail and accounter.ColferMax.

type PublicPod

type PublicPod struct {
	TypeID uint16

	X []byte

	Y []byte
}

func (*PublicPod) MarshalBinary

func (o *PublicPod) MarshalBinary() (data []byte, err error)

MarshalBinary encodes o as Colfer conform encoding.BinaryMarshaler. The error return option is accounter.ColferMax.

func (*PublicPod) MarshalLen

func (o *PublicPod) MarshalLen() (int, error)

MarshalLen returns the Colfer serial byte size. The error return option is accounter.ColferMax.

func (*PublicPod) MarshalTo

func (o *PublicPod) MarshalTo(buf []byte) int

MarshalTo encodes o as Colfer into buf and returns the number of bytes written. If the buffer is too small, MarshalTo will panic.

func (*PublicPod) Unmarshal

func (o *PublicPod) Unmarshal(data []byte) (int, error)

Unmarshal decodes data as Colfer and returns the number of bytes read. The error return options are io.EOF, accounter.ColferError and accounter.ColferMax.

func (*PublicPod) UnmarshalBinary

func (o *PublicPod) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes data as Colfer conform encoding.BinaryUnmarshaler. The error return options are io.EOF, accounter.ColferError, accounter.ColferTail and accounter.ColferMax.

Jump to

Keyboard shortcuts

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