ledger

package
v0.8.8 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2017 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ledger

type Ledger struct {
	Validator ValidatorHandler
	// contains filtered or unexported fields
}

Ledger represents the ledger in blockchain

func NewLedger

func NewLedger(db *db.BlockchainDB) *Ledger

NewLedger returns the ledger instance

func (*Ledger) AppendBlock

func (ledger *Ledger) AppendBlock(block *types.Block, flag bool) error

AppendBlock appends a new block to the ledger,flag = true pack up block ,flag = false sync block

func (*Ledger) GetBalance

func (ledger *Ledger) GetBalance(addr accounts.Address) (*big.Int, uint32, error)

GetBalance returns balance by account

func (*Ledger) GetBlockByHash

func (ledger *Ledger) GetBlockByHash(blockHashBytes []byte) (*types.BlockHeader, error)

GetBlockByHash returns the block detail by hash

func (*Ledger) GetBlockByNumber

func (ledger *Ledger) GetBlockByNumber(number uint32) (*types.BlockHeader, error)

GetBlockByNumber gets the block by the given number

func (*Ledger) GetBlockHashByNumber

func (ledger *Ledger) GetBlockHashByNumber(blockNum uint32) (crypto.Hash, error)

GetBlockHashByNumber returns block hash by block number

func (*Ledger) GetGenesisBlock

func (ledger *Ledger) GetGenesisBlock() *types.BlockHeader

GetGenesisBlock returns the genesis block of the ledger

func (*Ledger) GetLastBlockHash

func (ledger *Ledger) GetLastBlockHash() (crypto.Hash, error)

GetLastBlockHash returns last block hash

func (*Ledger) GetMergedTransaction

func (ledger *Ledger) GetMergedTransaction(duration uint32) (types.Transactions, error)

GetMergedTransaction returns merged transaction within a specified period of time

func (*Ledger) GetTmpBalance

func (ledger *Ledger) GetTmpBalance(addr accounts.Address) (*big.Int, error)

GetTmpBalance get balance

func (*Ledger) GetTransactionHashList

func (ledger *Ledger) GetTransactionHashList(number uint32) ([]crypto.Hash, error)

GetTransactionHashList returns transactions hash list by block number

func (*Ledger) GetTxByTxHash

func (ledger *Ledger) GetTxByTxHash(txHashBytes []byte) (*types.Transaction, error)

GetTxByTxHash returns transaction by tx hash []byte

func (*Ledger) GetTxsByBlockHash

func (ledger *Ledger) GetTxsByBlockHash(blockHashBytes []byte, transactionType uint32) (types.Transactions, error)

GetTxsByBlockHash returns transactions by block hash and transactionType

func (*Ledger) GetTxsByBlockNumber

func (ledger *Ledger) GetTxsByBlockNumber(blockNumber uint32, transactionType uint32) (types.Transactions, error)

GetTxsByBlockNumber returns transactions by blcokNumber and transactionType

func (*Ledger) GetTxsByMergeTxHash

func (ledger *Ledger) GetTxsByMergeTxHash(mergeTxHash crypto.Hash) (types.Transactions, error)

GetTxsByMergeTxHash gets transactions

func (*Ledger) Height

func (ledger *Ledger) Height() (uint32, error)

Height returns height of ledger

func (*Ledger) PutTxsHashByMergeTxHash

func (ledger *Ledger) PutTxsHashByMergeTxHash(mergeTxHash crypto.Hash, txsHashs []crypto.Hash) error

PutTxsHashByMergeTxHash put transactions hashs by merge transaction hash

func (*Ledger) QueryContract

func (ledger *Ledger) QueryContract(tx *types.Transaction) ([]byte, error)

QueryContract processes new contract query transaction

func (*Ledger) VerifyChain

func (ledger *Ledger) VerifyChain()

VerifyChain verifys the blockchain data

type ValidatorHandler

type ValidatorHandler interface {
	UpdateAccount(tx *types.Transaction)
	RollBackAccount(tx *types.Transaction)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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