Documentation ¶
Overview ¶
- Copyright (C) 2018 The ontology Authors
- This file is part of The ontology library. *
- The ontology is free software: you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version. *
- The ontology is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details. *
- You should have received a copy of the GNU Lesser General Public License
- along with The ontology. If not, see <http://www.gnu.org/licenses/>.
Storage of ledger
Index ¶
- Constants
- Variables
- func SaveNotify(eventStore scommon.EventStore, txHash common.Uint256, ...) error
- type BlockCache
- func (this *BlockCache) AddBlock(block *types.Block)
- func (this *BlockCache) AddTransaction(tx *types.Transaction, height uint32)
- func (this *BlockCache) ContainBlock(blockHash common.Uint256) bool
- func (this *BlockCache) ContainTransaction(txHash common.Uint256) bool
- func (this *BlockCache) GetBlock(blockHash common.Uint256) *types.Block
- func (this *BlockCache) GetTransaction(txHash common.Uint256) (*types.Transaction, uint32)
- type BlockStore
- func (this *BlockStore) ClearAll() error
- func (this *BlockStore) Close() error
- func (this *BlockStore) CommitTo() error
- func (this *BlockStore) ContainBlock(blockHash common.Uint256) (bool, error)
- func (this *BlockStore) ContainTransaction(txHash common.Uint256) (bool, error)
- func (this *BlockStore) GetBlock(blockHash common.Uint256) (*types.Block, error)
- func (this *BlockStore) GetBlockHash(height uint32) (common.Uint256, error)
- func (this *BlockStore) GetCurrentBlock() (common.Uint256, uint32, error)
- func (this *BlockStore) GetHeader(blockHash common.Uint256) (*types.Header, error)
- func (this *BlockStore) GetHeaderIndexList() (map[uint32]common.Uint256, error)
- func (this *BlockStore) GetSysFeeAmount(blockHash common.Uint256) (common.Fixed64, error)
- func (this *BlockStore) GetTransaction(txHash common.Uint256) (*types.Transaction, uint32, error)
- func (this *BlockStore) GetVersion() (byte, error)
- func (this *BlockStore) NewBatch()
- func (this *BlockStore) SaveBlock(block *types.Block) error
- func (this *BlockStore) SaveBlockHash(height uint32, blockHash common.Uint256)
- func (this *BlockStore) SaveCurrentBlock(height uint32, blockHash common.Uint256) error
- func (this *BlockStore) SaveHeader(block *types.Block, sysFee common.Fixed64) error
- func (this *BlockStore) SaveHeaderIndexList(startIndex uint32, indexList []common.Uint256) error
- func (this *BlockStore) SaveTransaction(tx *types.Transaction, height uint32) error
- func (this *BlockStore) SaveVersion(ver byte) error
- type CacheCodeTable
- type EventStore
- func (this *EventStore) ClearAll() error
- func (this *EventStore) Close() error
- func (this *EventStore) CommitTo() error
- func (this *EventStore) GetCurrentBlock() (common.Uint256, uint32, error)
- func (this *EventStore) GetEventNotifyByBlock(height uint32) ([]*event.ExecuteNotify, error)
- func (this *EventStore) GetEventNotifyByTx(txHash common.Uint256) (*event.ExecuteNotify, error)
- func (this *EventStore) NewBatch()
- func (this *EventStore) SaveCurrentBlock(height uint32, blockHash common.Uint256) error
- func (this *EventStore) SaveEventNotifyByBlock(height uint32, txHashs []common.Uint256) error
- func (this *EventStore) SaveEventNotifyByTx(txHash common.Uint256, notify *event.ExecuteNotify) error
- type LedgerStoreImp
- func (this *LedgerStoreImp) AddBlock(block *types.Block, stateMerkleRoot common.Uint256) error
- func (this *LedgerStoreImp) AddHeader(header *types.Header) error
- func (this *LedgerStoreImp) AddHeaders(headers []*types.Header) error
- func (this *LedgerStoreImp) Close() error
- func (this *LedgerStoreImp) ExecuteBlock(block *types.Block) (result store.ExecuteResult, err error)
- func (this *LedgerStoreImp) GetBlockByHash(blockHash common.Uint256) (*types.Block, error)
- func (this *LedgerStoreImp) GetBlockByHeight(height uint32) (*types.Block, error)
- func (this *LedgerStoreImp) GetBlockHash(height uint32) common.Uint256
- func (this *LedgerStoreImp) GetBlockRootWithNewTxRoots(startHeight uint32, txRoots []common.Uint256) common.Uint256
- func (this *LedgerStoreImp) GetBookkeeperState() (*states.BookkeeperState, error)
- func (this *LedgerStoreImp) GetContractState(contractHash common.Address) (*payload.DeployCode, error)
- func (this *LedgerStoreImp) GetCurrentBlock() (uint32, common.Uint256)
- func (this *LedgerStoreImp) GetCurrentBlockHash() common.Uint256
- func (this *LedgerStoreImp) GetCurrentBlockHeight() uint32
- func (this *LedgerStoreImp) GetCurrentHeaderHash() common.Uint256
- func (this *LedgerStoreImp) GetCurrentHeaderHeight() uint32
- func (this *LedgerStoreImp) GetEventNotifyByBlock(height uint32) ([]*event.ExecuteNotify, error)
- func (this *LedgerStoreImp) GetEventNotifyByTx(tx common.Uint256) (*event.ExecuteNotify, error)
- func (this *LedgerStoreImp) GetHeaderByHash(blockHash common.Uint256) (*types.Header, error)
- func (this *LedgerStoreImp) GetHeaderByHeight(height uint32) (*types.Header, error)
- func (this *LedgerStoreImp) GetMerkleProof(proofHeight, rootHeight uint32) ([]common.Uint256, error)
- func (this *LedgerStoreImp) GetStateMerkleRoot(height uint32) (common.Uint256, error)
- func (this *LedgerStoreImp) GetStorageItem(key *states.StorageKey) (*states.StorageItem, error)
- func (this *LedgerStoreImp) GetSysFeeAmount(blockHash common.Uint256) (common.Fixed64, error)
- func (this *LedgerStoreImp) GetTransaction(txHash common.Uint256) (*types.Transaction, uint32, error)
- func (this *LedgerStoreImp) InitLedgerStoreWithGenesisBlock(genesisBlock *types.Block, defaultBookkeeper []keypair.PublicKey) error
- func (this *LedgerStoreImp) IsContainBlock(blockHash common.Uint256) (bool, error)
- func (this *LedgerStoreImp) IsContainTransaction(txHash common.Uint256) (bool, error)
- func (this *LedgerStoreImp) PreExecuteContract(tx *types.Transaction) (*sstate.PreExecResult, error)
- func (this *LedgerStoreImp) SubmitBlock(block *types.Block, result store.ExecuteResult) error
- type StateCache
- type StateStore
- func (self *StateStore) AddBlockMerkleTreeRoot(txRoot common.Uint256) error
- func (self *StateStore) AddStateMerkleTreeRoot(blockHeight uint32, writeSetHash common.Uint256) error
- func (self *StateStore) BatchDeleteRawKey(key []byte)
- func (self *StateStore) BatchPutRawKeyVal(key, val []byte)
- func (self *StateStore) CheckStorage() error
- func (self *StateStore) ClearAll() error
- func (self *StateStore) Close() error
- func (self *StateStore) CommitTo() error
- func (self *StateStore) GetBlockMerkleTree() (uint32, []common.Uint256, error)
- func (self *StateStore) GetBlockRootWithNewTxRoots(txRoots []common.Uint256) common.Uint256
- func (self *StateStore) GetBookkeeperState() (*states.BookkeeperState, error)
- func (self *StateStore) GetContractState(contractHash common.Address) (*payload.DeployCode, error)
- func (self *StateStore) GetCurrentBlock() (common.Uint256, uint32, error)
- func (self *StateStore) GetMerkleProof(proofHeight, rootHeight uint32) ([]common.Uint256, error)
- func (self *StateStore) GetStateMerkleRoot(height uint32) (result common.Uint256, err error)
- func (self *StateStore) GetStateMerkleRootWithNewHash(writeSetHash common.Uint256) common.Uint256
- func (self *StateStore) GetStateMerkleTree() (uint32, []common.Uint256, error)
- func (self *StateStore) GetStorageState(key *states.StorageKey) (*states.StorageItem, error)
- func (self *StateStore) HandleDeployTransaction(store store.LedgerStore, overlay *overlaydb.OverlayDB, cache *storage.CacheDB, ...) error
- func (self *StateStore) HandleInvokeTransaction(store store.LedgerStore, overlay *overlaydb.OverlayDB, cache *storage.CacheDB, ...) error
- func (self *StateStore) NewBatch()
- func (self *StateStore) NewOverlayDB() *overlaydb.OverlayDB
- func (self *StateStore) NewStateBatch() *statestore.StateBatch
- func (self *StateStore) SaveBookkeeperState(bookkeeperState *states.BookkeeperState) error
- func (self *StateStore) SaveCurrentBlock(height uint32, blockHash common.Uint256) error
- type TransactionCacheaValue
Constants ¶
const ( BLOCK_CAHE_SIZE = 10 //Block cache size TRANSACTION_CACHE_SIZE = 10000 //Transaction cache size )
const ( SYSTEM_VERSION = byte(1) //Version of ledger store HEADER_INDEX_BATCH_SIZE = uint32(2000) //Bath size of saving header index )
const (
STATE_CACHE_SIZE = 100000
)
Variables ¶
var ( //Storage save path. DBDirEvent = "ledgerevent" DBDirBlock = "block" DBDirState = "states" MerkleTreeStorePath = "merkle_tree.db" )
var (
BOOKKEEPER = []byte("Bookkeeper") //Bookkeeper store key
)
Functions ¶
func SaveNotify ¶
func SaveNotify(eventStore scommon.EventStore, txHash common.Uint256, notify *event.ExecuteNotify) error
Types ¶
type BlockCache ¶
type BlockCache struct {
// contains filtered or unexported fields
}
BlockCache with block cache and transaction hash
func NewBlockCache ¶
func NewBlockCache() (*BlockCache, error)
NewBlockCache return BlockCache instance
func (*BlockCache) AddBlock ¶
func (this *BlockCache) AddBlock(block *types.Block)
AddBlock to cache
func (*BlockCache) AddTransaction ¶
func (this *BlockCache) AddTransaction(tx *types.Transaction, height uint32)
AddTransaction add transaction to block cache
func (*BlockCache) ContainBlock ¶
func (this *BlockCache) ContainBlock(blockHash common.Uint256) bool
ContainBlock return whether block is in cache
func (*BlockCache) ContainTransaction ¶
func (this *BlockCache) ContainTransaction(txHash common.Uint256) bool
ContainTransaction return whether transaction is in cache
func (*BlockCache) GetBlock ¶
func (this *BlockCache) GetBlock(blockHash common.Uint256) *types.Block
GetBlock return block by block hash from cache
func (*BlockCache) GetTransaction ¶
func (this *BlockCache) GetTransaction(txHash common.Uint256) (*types.Transaction, uint32)
GetTransaction return transaction by transaction hash from cache
type BlockStore ¶
type BlockStore struct {
// contains filtered or unexported fields
}
Block store save the data of block & transaction
func NewBlockStore ¶
func NewBlockStore(dbDir string, enableCache bool) (*BlockStore, error)
NewBlockStore return the block store instance
func (*BlockStore) ClearAll ¶
func (this *BlockStore) ClearAll() error
ClearAll clear all the data of block store
func (*BlockStore) CommitTo ¶
func (this *BlockStore) CommitTo() error
CommitTo commit the batch to store
func (*BlockStore) ContainBlock ¶
func (this *BlockStore) ContainBlock(blockHash common.Uint256) (bool, error)
ContainBlock return the block specified by block hash save in store
func (*BlockStore) ContainTransaction ¶
func (this *BlockStore) ContainTransaction(txHash common.Uint256) (bool, error)
IsContainTransaction return whether the transaction is in store
func (*BlockStore) GetBlockHash ¶
func (this *BlockStore) GetBlockHash(height uint32) (common.Uint256, error)
GetBlockHash return block hash by block height
func (*BlockStore) GetCurrentBlock ¶
func (this *BlockStore) GetCurrentBlock() (common.Uint256, uint32, error)
GetCurrentBlock return the current block hash and current block height
func (*BlockStore) GetHeaderIndexList ¶
func (this *BlockStore) GetHeaderIndexList() (map[uint32]common.Uint256, error)
GetHeaderIndexList return the head index store in header index list
func (*BlockStore) GetSysFeeAmount ¶
GetSysFeeAmount return the sys fee for block by block hash
func (*BlockStore) GetTransaction ¶
func (this *BlockStore) GetTransaction(txHash common.Uint256) (*types.Transaction, uint32, error)
GetTransaction return transaction by transaction hash
func (*BlockStore) GetVersion ¶
func (this *BlockStore) GetVersion() (byte, error)
GetVersion return the version of store
func (*BlockStore) SaveBlock ¶
func (this *BlockStore) SaveBlock(block *types.Block) error
SaveBlock persist block to store
func (*BlockStore) SaveBlockHash ¶
func (this *BlockStore) SaveBlockHash(height uint32, blockHash common.Uint256)
SaveBlockHash persist block height and block hash to store
func (*BlockStore) SaveCurrentBlock ¶
func (this *BlockStore) SaveCurrentBlock(height uint32, blockHash common.Uint256) error
SaveCurrentBlock persist the current block height and current block hash to store
func (*BlockStore) SaveHeader ¶
SaveHeader persist block header to store
func (*BlockStore) SaveHeaderIndexList ¶
func (this *BlockStore) SaveHeaderIndexList(startIndex uint32, indexList []common.Uint256) error
SaveHeaderIndexList persist header index list to store
func (*BlockStore) SaveTransaction ¶
func (this *BlockStore) SaveTransaction(tx *types.Transaction, height uint32) error
SaveTransaction persist transaction to store
func (*BlockStore) SaveVersion ¶
func (this *BlockStore) SaveVersion(ver byte) error
SaveVersion persist version to store
type CacheCodeTable ¶
type CacheCodeTable struct {
// contains filtered or unexported fields
}
type EventStore ¶
type EventStore struct {
// contains filtered or unexported fields
}
Saving event notifies gen by smart contract execution
func NewEventStore ¶
func NewEventStore(dbDir string) (*EventStore, error)
NewEventStore return event store instance
func (*EventStore) ClearAll ¶
func (this *EventStore) ClearAll() error
ClearAll all data in event store
func (*EventStore) CommitTo ¶
func (this *EventStore) CommitTo() error
CommitTo event store batch to store
func (*EventStore) GetCurrentBlock ¶
func (this *EventStore) GetCurrentBlock() (common.Uint256, uint32, error)
GetCurrentBlock return current block hash, and block height
func (*EventStore) GetEventNotifyByBlock ¶
func (this *EventStore) GetEventNotifyByBlock(height uint32) ([]*event.ExecuteNotify, error)
GetEventNotifyByBlock return all event notify of transaction in block
func (*EventStore) GetEventNotifyByTx ¶
func (this *EventStore) GetEventNotifyByTx(txHash common.Uint256) (*event.ExecuteNotify, error)
GetEventNotifyByTx return event notify by trasanction hash
func (*EventStore) SaveCurrentBlock ¶
func (this *EventStore) SaveCurrentBlock(height uint32, blockHash common.Uint256) error
SaveCurrentBlock persist current block height and block hash to event store
func (*EventStore) SaveEventNotifyByBlock ¶
func (this *EventStore) SaveEventNotifyByBlock(height uint32, txHashs []common.Uint256) error
SaveEventNotifyByBlock persist transaction hash which have event notify to store
func (*EventStore) SaveEventNotifyByTx ¶
func (this *EventStore) SaveEventNotifyByTx(txHash common.Uint256, notify *event.ExecuteNotify) error
SaveEventNotifyByTx persist event notify by transaction hash
type LedgerStoreImp ¶
type LedgerStoreImp struct {
// contains filtered or unexported fields
}
LedgerStoreImp is main store struct fo ledger
func NewLedgerStore ¶
func NewLedgerStore(dataDir string, stateHashHeight uint32) (*LedgerStoreImp, error)
NewLedgerStore return LedgerStoreImp instance
func (*LedgerStoreImp) AddBlock ¶
AddBlock add the block to store. When the block is not the next block, it will be cache. until the missing block arrived
func (*LedgerStoreImp) AddHeader ¶
func (this *LedgerStoreImp) AddHeader(header *types.Header) error
AddHeader add header to cache, and add the mapping of block height to block hash. Using in block sync
func (*LedgerStoreImp) AddHeaders ¶
func (this *LedgerStoreImp) AddHeaders(headers []*types.Header) error
AddHeaders bath add header.
func (*LedgerStoreImp) ExecuteBlock ¶ added in v1.6.0
func (this *LedgerStoreImp) ExecuteBlock(block *types.Block) (result store.ExecuteResult, err error)
func (*LedgerStoreImp) GetBlockByHash ¶
GetBlockByHash return block by block hash. Wrap function of BlockStore.GetBlockByHash
func (*LedgerStoreImp) GetBlockByHeight ¶
func (this *LedgerStoreImp) GetBlockByHeight(height uint32) (*types.Block, error)
GetBlockByHeight return block by height.
func (*LedgerStoreImp) GetBlockHash ¶
func (this *LedgerStoreImp) GetBlockHash(height uint32) common.Uint256
GetBlockHash return the block hash by block height
func (*LedgerStoreImp) GetBlockRootWithNewTxRoots ¶ added in v1.6.0
func (this *LedgerStoreImp) GetBlockRootWithNewTxRoots(startHeight uint32, txRoots []common.Uint256) common.Uint256
GetBlockRootWithNewTxRoots return the block root(merkle root of blocks) after add a new tx root of block
func (*LedgerStoreImp) GetBookkeeperState ¶
func (this *LedgerStoreImp) GetBookkeeperState() (*states.BookkeeperState, error)
GetBookkeeperState return the bookkeeper state. Wrap function of StateStore.GetBookkeeperState
func (*LedgerStoreImp) GetContractState ¶
func (this *LedgerStoreImp) GetContractState(contractHash common.Address) (*payload.DeployCode, error)
GetContractState return contract by contract address. Wrap function of StateStore.GetContractState
func (*LedgerStoreImp) GetCurrentBlock ¶
func (this *LedgerStoreImp) GetCurrentBlock() (uint32, common.Uint256)
GetCurrentBlock return the current block height, and block hash. Current block means the latest block in store.
func (*LedgerStoreImp) GetCurrentBlockHash ¶
func (this *LedgerStoreImp) GetCurrentBlockHash() common.Uint256
GetCurrentBlockHash return the current block hash
func (*LedgerStoreImp) GetCurrentBlockHeight ¶
func (this *LedgerStoreImp) GetCurrentBlockHeight() uint32
GetCurrentBlockHeight return the current block height
func (*LedgerStoreImp) GetCurrentHeaderHash ¶
func (this *LedgerStoreImp) GetCurrentHeaderHash() common.Uint256
GetCurrentHeaderHash return the current header hash. The current header means the latest header.
func (*LedgerStoreImp) GetCurrentHeaderHeight ¶
func (this *LedgerStoreImp) GetCurrentHeaderHeight() uint32
GetCurrentHeaderHeight return the current header height. In block sync states, Header height is usually higher than block height that is has already committed to storage
func (*LedgerStoreImp) GetEventNotifyByBlock ¶
func (this *LedgerStoreImp) GetEventNotifyByBlock(height uint32) ([]*event.ExecuteNotify, error)
GetEventNotifyByBlock return the transaction hash which have event notice after execution of smart contract. Wrap function of EventStore.GetEventNotifyByBlock
func (*LedgerStoreImp) GetEventNotifyByTx ¶
func (this *LedgerStoreImp) GetEventNotifyByTx(tx common.Uint256) (*event.ExecuteNotify, error)
GetEventNotifyByTx return the events notify gen by executing of smart contract. Wrap function of EventStore.GetEventNotifyByTx
func (*LedgerStoreImp) GetHeaderByHash ¶
GetHeaderByHash return the block header by block hash
func (*LedgerStoreImp) GetHeaderByHeight ¶
func (this *LedgerStoreImp) GetHeaderByHeight(height uint32) (*types.Header, error)
GetHeaderByHash return the block header by block height
func (*LedgerStoreImp) GetMerkleProof ¶
func (this *LedgerStoreImp) GetMerkleProof(proofHeight, rootHeight uint32) ([]common.Uint256, error)
GetMerkleProof return the block merkle proof. Wrap function of StateStore.GetMerkleProof
func (*LedgerStoreImp) GetStateMerkleRoot ¶ added in v1.6.0
func (this *LedgerStoreImp) GetStateMerkleRoot(height uint32) (common.Uint256, error)
func (*LedgerStoreImp) GetStorageItem ¶
func (this *LedgerStoreImp) GetStorageItem(key *states.StorageKey) (*states.StorageItem, error)
GetStorageItem return the storage value of the key in smart contract. Wrap function of StateStore.GetStorageState
func (*LedgerStoreImp) GetSysFeeAmount ¶
GetSysFeeAmount return the sys fee for block by block hash. Wrap function of BlockStore.GetSysFeeAmount
func (*LedgerStoreImp) GetTransaction ¶
func (this *LedgerStoreImp) GetTransaction(txHash common.Uint256) (*types.Transaction, uint32, error)
GetTransaction return transaction by transaction hash. Wrap function of BlockStore.GetTransaction
func (*LedgerStoreImp) InitLedgerStoreWithGenesisBlock ¶
func (this *LedgerStoreImp) InitLedgerStoreWithGenesisBlock(genesisBlock *types.Block, defaultBookkeeper []keypair.PublicKey) error
InitLedgerStoreWithGenesisBlock init the ledger store with genesis block. It's the first operation after NewLedgerStore.
func (*LedgerStoreImp) IsContainBlock ¶
func (this *LedgerStoreImp) IsContainBlock(blockHash common.Uint256) (bool, error)
IsContainBlock return whether the block is in store
func (*LedgerStoreImp) IsContainTransaction ¶
func (this *LedgerStoreImp) IsContainTransaction(txHash common.Uint256) (bool, error)
IsContainTransaction return whether the transaction is in store. Wrap function of BlockStore.ContainTransaction
func (*LedgerStoreImp) PreExecuteContract ¶
func (this *LedgerStoreImp) PreExecuteContract(tx *types.Transaction) (*sstate.PreExecResult, error)
PreExecuteContract return the result of smart contract execution without commit to store
func (*LedgerStoreImp) SubmitBlock ¶ added in v1.6.0
func (this *LedgerStoreImp) SubmitBlock(block *types.Block, result store.ExecuteResult) error
type StateCache ¶
type StateCache struct {
// contains filtered or unexported fields
}
func NewStateCache ¶
func NewStateCache() (*StateCache, error)
func (*StateCache) AddState ¶
func (this *StateCache) AddState(key []byte, state states.StateValue)
func (*StateCache) DeleteState ¶
func (this *StateCache) DeleteState(key []byte)
func (*StateCache) GetState ¶
func (this *StateCache) GetState(key []byte) states.StateValue
type StateStore ¶
type StateStore struct {
// contains filtered or unexported fields
}
StateStore saving the data of ledger states. Like balance of account, and the execution result of smart contract
func NewMemStateStore ¶ added in v1.6.0
func NewMemStateStore(stateHashHeight uint32) *StateStore
for test
func NewStateStore ¶
func NewStateStore(dbDir, merklePath string, stateHashCheckHeight uint32) (*StateStore, error)
NewStateStore return state store instance
func (*StateStore) AddBlockMerkleTreeRoot ¶ added in v1.6.0
func (self *StateStore) AddBlockMerkleTreeRoot(txRoot common.Uint256) error
AddBlockMerkleTreeRoot add a new tree root
func (*StateStore) AddStateMerkleTreeRoot ¶ added in v1.6.0
func (self *StateStore) AddStateMerkleTreeRoot(blockHeight uint32, writeSetHash common.Uint256) error
func (*StateStore) BatchDeleteRawKey ¶ added in v1.6.0
func (self *StateStore) BatchDeleteRawKey(key []byte)
func (*StateStore) BatchPutRawKeyVal ¶ added in v1.6.0
func (self *StateStore) BatchPutRawKeyVal(key, val []byte)
func (*StateStore) CheckStorage ¶ added in v1.6.0
func (self *StateStore) CheckStorage() error
func (*StateStore) ClearAll ¶
func (self *StateStore) ClearAll() error
ClearAll clear all data in state store
func (*StateStore) CommitTo ¶
func (self *StateStore) CommitTo() error
CommitTo commit state batch to state store
func (*StateStore) GetBlockMerkleTree ¶ added in v1.6.0
func (self *StateStore) GetBlockMerkleTree() (uint32, []common.Uint256, error)
GetBlockMerkleTree return merkle tree size an tree node
func (*StateStore) GetBlockRootWithNewTxRoots ¶ added in v1.6.0
func (self *StateStore) GetBlockRootWithNewTxRoots(txRoots []common.Uint256) common.Uint256
func (*StateStore) GetBookkeeperState ¶
func (self *StateStore) GetBookkeeperState() (*states.BookkeeperState, error)
GetBookkeeperState return current book keeper states
func (*StateStore) GetContractState ¶
func (self *StateStore) GetContractState(contractHash common.Address) (*payload.DeployCode, error)
GetContractState return contract by contract address
func (*StateStore) GetCurrentBlock ¶
func (self *StateStore) GetCurrentBlock() (common.Uint256, uint32, error)
GetCurrentBlock return current block height and current hash in state store
func (*StateStore) GetMerkleProof ¶
func (self *StateStore) GetMerkleProof(proofHeight, rootHeight uint32) ([]common.Uint256, error)
GetMerkleProof return merkle proof of block
func (*StateStore) GetStateMerkleRoot ¶ added in v1.6.0
func (self *StateStore) GetStateMerkleRoot(height uint32) (result common.Uint256, err error)
func (*StateStore) GetStateMerkleRootWithNewHash ¶ added in v1.6.0
func (self *StateStore) GetStateMerkleRootWithNewHash(writeSetHash common.Uint256) common.Uint256
func (*StateStore) GetStateMerkleTree ¶ added in v1.6.0
func (self *StateStore) GetStateMerkleTree() (uint32, []common.Uint256, error)
GetStateMerkleTree return merkle tree size an tree node
func (*StateStore) GetStorageState ¶
func (self *StateStore) GetStorageState(key *states.StorageKey) (*states.StorageItem, error)
GetStorageItem return the storage value of the key in smart contract.
func (*StateStore) HandleDeployTransaction ¶
func (self *StateStore) HandleDeployTransaction(store store.LedgerStore, overlay *overlaydb.OverlayDB, cache *storage.CacheDB, tx *types.Transaction, block *types.Block, notify *event.ExecuteNotify) error
HandleDeployTransaction deal with smart contract deploy transaction
func (*StateStore) HandleInvokeTransaction ¶
func (self *StateStore) HandleInvokeTransaction(store store.LedgerStore, overlay *overlaydb.OverlayDB, cache *storage.CacheDB, tx *types.Transaction, block *types.Block, notify *event.ExecuteNotify) error
HandleInvokeTransaction deal with smart contract invoke transaction
func (*StateStore) NewOverlayDB ¶ added in v1.5.1
func (self *StateStore) NewOverlayDB() *overlaydb.OverlayDB
func (*StateStore) NewStateBatch ¶
func (self *StateStore) NewStateBatch() *statestore.StateBatch
NewStateBatch return state commit bathe. Usually using in smart contract execution
func (*StateStore) SaveBookkeeperState ¶
func (self *StateStore) SaveBookkeeperState(bookkeeperState *states.BookkeeperState) error
SaveBookkeeperState persist book keeper state to store
func (*StateStore) SaveCurrentBlock ¶
func (self *StateStore) SaveCurrentBlock(height uint32, blockHash common.Uint256) error
SaveCurrentBlock persist current block to state store
type TransactionCacheaValue ¶
type TransactionCacheaValue struct { Tx *types.Transaction Height uint32 }
Value of transaction cache