Documentation
¶
Index ¶
- type Ledger
- func (ledger *Ledger) AppendBlock(block *types.Block, flag bool) error
- func (ledger *Ledger) GetBalance(addr accounts.Address) (*big.Int, uint32, error)
- func (ledger *Ledger) GetBlockByHash(blockHashBytes []byte) (*types.BlockHeader, error)
- func (ledger *Ledger) GetBlockByNumber(number uint32) (*types.BlockHeader, error)
- func (ledger *Ledger) GetBlockHashByNumber(blockNum uint32) (crypto.Hash, error)
- func (ledger *Ledger) GetGenesisBlock() *types.BlockHeader
- func (ledger *Ledger) GetLastBlockHash() (crypto.Hash, error)
- func (ledger *Ledger) GetMergedTransaction(duration uint32) (types.Transactions, error)
- func (ledger *Ledger) GetTmpBalance(addr accounts.Address) (*big.Int, error)
- func (ledger *Ledger) GetTransactionHashList(number uint32) ([]crypto.Hash, error)
- func (ledger *Ledger) GetTxByTxHash(txHashBytes []byte) (*types.Transaction, error)
- func (ledger *Ledger) GetTxsByBlockHash(blockHashBytes []byte, transactionType uint32) (types.Transactions, error)
- func (ledger *Ledger) GetTxsByBlockNumber(blockNumber uint32, transactionType uint32) (types.Transactions, error)
- func (ledger *Ledger) GetTxsByMergeTxHash(mergeTxHash crypto.Hash) (types.Transactions, error)
- func (ledger *Ledger) Height() (uint32, error)
- func (ledger *Ledger) PutTxsHashByMergeTxHash(mergeTxHash crypto.Hash, txsHashs []crypto.Hash) error
- func (ledger *Ledger) QueryContract(tx *types.Transaction) ([]byte, error)
- func (ledger *Ledger) VerifyChain()
- type ValidatorHandler
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 (*Ledger) AppendBlock ¶
AppendBlock appends a new block to the ledger,flag = true pack up block ,flag = false sync block
func (*Ledger) GetBalance ¶
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 ¶
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 ¶
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 ¶
GetTmpBalance get balance
func (*Ledger) GetTransactionHashList ¶
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 ¶
GetTxsByMergeTxHash gets transactions
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)
}