block

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2020 License: AGPL-3.0 Imports: 12 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Checker

func Checker(item interface{}, value interface{}) bool

Checker is a function to be sent to concurrent.Slice.Check to compare the ID of both blocks. Item will be the original and Value will be either the new block we're trying to compare, its ID as a `Hash`, or its oblivionHash string.

func RebuildBlockID

func RebuildBlockID(forBlock Block) (bkID model.Hash, err error)

RebuildBlockID ...

func RebuildNonce

func RebuildNonce(forBlock Block, idkey string) (nonce model.Hash, err error)

RebuildNonce ...

func RebuildOblivionHash

func RebuildOblivionHash(forBlock Block) (bkOblivionHash string, err error)

RebuildOblivionHash ...

Types

type Block

type Block struct {
	BlockID         model.Hash               `json:"blockId"`
	Header          Header                   `json:"header"`
	PreviousBlockID model.Hash               `json:"previousBlockId"`
	Timestamp       uint64                   `json:"timestamp"`
	PeriodID        uint64                   `json:"periodId"`
	Transactions    transaction.Transactions `json:"transactions"`
	OblivionHash    string                   `json:"oblivionHash,omitempty"`
}

Block ...

func (*Block) BuildHeader

func (bk *Block) BuildHeader(idkey string, decompressedPublicKey []byte, privateKey []byte) error

BuildHeader ...

func (*Block) BuildNonce

func (bk *Block) BuildNonce(idkey string) error

BuildNonce ...

func (*Block) CreateBlockID

func (bk *Block) CreateBlockID() error

CreateBlockID ...

func (Block) Dump

func (bk Block) Dump()

Dump ...

func (Block) DumpByte

func (bk Block) DumpByte() ([]byte, error)

DumpByte ...

func (*Block) GenerateOblivionHash

func (bk *Block) GenerateOblivionHash() error

GenerateOblivionHash ...

func (Block) GetByteArrayValues

func (bk Block) GetByteArrayValues() (values [][]byte)

GetByteArrayValues ...

func (*Block) IsEmpty

func (bk *Block) IsEmpty() bool

IsEmpty returns `true` if all its field are empty.

type Blocks added in v1.5.8

type Blocks []*Block

Blocks ...

func (Blocks) Contains added in v1.5.8

func (b Blocks) Contains(item *Block) bool

Contains ...

func (*Blocks) Equals added in v1.5.8

func (b *Blocks) Equals(to *Blocks) bool

Equals ...

func (Blocks) Get added in v1.5.9

func (b Blocks) Get(id model.Hash) *Block

Get ...

func (Blocks) Len added in v1.5.8

func (b Blocks) Len() int

func (Blocks) Less added in v1.5.8

func (b Blocks) Less(i, j int) bool

func (Blocks) Swap added in v1.5.8

func (b Blocks) Swap(i, j int)
type Header struct {
	LastMiners      LastMiners      `json:"lastMiners"`
	NewTransactions model.Hashes    `json:"newTransactions"`
	Signature       model.Signature `json:"signature"`
	PublicKey       model.Key       `json:"publicKey"`
	Nonce           model.Hash      `json:"nonce"`
}

Header ...

type LastMiners

type LastMiners struct {
	OnPeriodID uint64     `json:"onPeriodId"`
	Valid      model.Keys `json:"valid"`
	Invalid    model.Keys `json:"invalid"`
}

LastMiners ...

Jump to

Keyboard shortcuts

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