consensus

package
v1.0.16 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2022 License: ISC Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	Id   *hash.Hash
	Txs  []consensus.Tx
	Time time.Time
}

func (*Block) Accept

func (b *Block) Accept() error

func (*Block) Bytes

func (b *Block) Bytes() []byte

func (*Block) Height

func (b *Block) Height() uint64

func (*Block) ID

func (b *Block) ID() *hash.Hash

func (*Block) Parent

func (b *Block) Parent() *hash.Hash

func (*Block) Reject

func (b *Block) Reject() error

func (*Block) SetStatus

func (b *Block) SetStatus(status consensus.Status)

func (*Block) Status

func (b *Block) Status() consensus.Status

func (*Block) String

func (b *Block) String() string

func (*Block) Timestamp

func (b *Block) Timestamp() time.Time

func (*Block) Transactions

func (b *Block) Transactions() []consensus.Tx

func (*Block) Verify

func (b *Block) Verify() error

type ChainState

type ChainState struct {
}

type Context

type Context struct {
	context.Context
	Cfg    *config.Config
	Tp     consensus.TxPool
	Notify consensus.Notify
}

func (*Context) GetConfig

func (ctx *Context) GetConfig() *config.Config

func (*Context) GetNotify

func (ctx *Context) GetNotify() consensus.Notify

func (*Context) GetTxPool

func (ctx *Context) GetTxPool() consensus.TxPool

type ExportTx

type ExportTx struct {
	*Tx
	*types.Transaction
}

func NewExportTx

func NewExportTx(tx *types.Transaction) (*ExportTx, error)

func (*ExportTx) CheckSanity

func (etx *ExportTx) CheckSanity() error

type ImportTx

type ImportTx struct {
	*Tx
	*types.Transaction
}

func NewImportTx

func NewImportTx(tx *types.Transaction) (*ImportTx, error)

func (*ImportTx) CheckSanity

func (itx *ImportTx) CheckSanity() error

func (*ImportTx) GetPKAddress

func (itx *ImportTx) GetPKAddress() (*address.SecpPubKeyAddress, error)

func (*ImportTx) GetPKScript

func (itx *ImportTx) GetPKScript() ([]byte, error)

func (*ImportTx) GetTransactionForEngine

func (itx *ImportTx) GetTransactionForEngine() (*types.Transaction, error)

func (*ImportTx) SetCoinbaseTx added in v1.0.16

func (itx *ImportTx) SetCoinbaseTx(tx *types.Transaction) error

func (*ImportTx) Sign

func (itx *ImportTx) Sign(privateKey ecc.PrivateKey) error

type Tx

type Tx struct {
	Type  types.TxType
	From  string
	To    string
	Value uint64
	Data  []byte
}

func (*Tx) GetData

func (tx *Tx) GetData() []byte

func (*Tx) GetFrom

func (tx *Tx) GetFrom() string

func (*Tx) GetTo

func (tx *Tx) GetTo() string

func (*Tx) GetTxType

func (tx *Tx) GetTxType() types.TxType

func (*Tx) GetValue

func (tx *Tx) GetValue() uint64

type VMI

type VMI interface {
	VerifyTx(tx consensus.Tx) (int64, error)
	VerifyTxSanity(tx consensus.Tx) error
	GetVM(id string) (consensus.ChainVM, error)
	CheckConnectBlock(block *types.SerializedBlock) error
	ConnectBlock(block *types.SerializedBlock) error
	DisconnectBlock(block *types.SerializedBlock) error
	AddTxToMempool(tx *types.Transaction, local bool) (int64, error)
	RemoveTxFromMempool(tx *types.Transaction) error
	GetTxsFromMempool() ([]*types.Transaction, error)
	GetMempoolSize() int64
	ResetTemplate() error
	Genesis(txs []*types.Tx) *hash.Hash
}

type VMTx

type VMTx struct {
	*Tx
	*types.Transaction
	// contains filtered or unexported fields
}

func NewVMTx

func NewVMTx(tx *types.Transaction) (*VMTx, error)

func (*VMTx) CheckSanity

func (vt *VMTx) CheckSanity() error

func (*VMTx) SetCoinbaseTx

func (vt *VMTx) SetCoinbaseTx(tx *types.Transaction) error

func (*VMTx) SetVMI

func (vt *VMTx) SetVMI(vmi VMI)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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