Documentation ¶
Index ¶
- func SendBalance(sender, receiver *AccountState, amount *big.Int) error
- type AccountState
- func (as *AccountState) AccountID() types.AccountID
- func (as *AccountState) AddBalance(amount *big.Int)
- func (as *AccountState) Balance() *big.Int
- func (as *AccountState) CodeHash() []byte
- func (as *AccountState) ID() []byte
- func (as *AccountState) IDNoPadding() []byte
- func (as *AccountState) IsContract() bool
- func (as *AccountState) IsDeploy() bool
- func (as *AccountState) IsNew() bool
- func (as *AccountState) IsRedeploy() bool
- func (as *AccountState) Nonce() uint64
- func (as *AccountState) PutState() error
- func (as *AccountState) RP() uint64
- func (as *AccountState) Reset()
- func (as *AccountState) SetCodeHash(codeHash []byte)
- func (as *AccountState) SetNonce(nonce uint64)
- func (as *AccountState) SetRP(sqlRecoveryPoint uint64)
- func (as *AccountState) SetRedeploy()
- func (as *AccountState) SetStorageRoot(storageRoot []byte)
- func (as *AccountState) State() *types.State
- func (as *AccountState) StorageRoot() []byte
- func (as *AccountState) SubBalance(amount *big.Int)
- type BlockSnapshot
- type BlockState
- func (bs *BlockState) AddABI(key types.AccountID, abi *types.ABI)
- func (bs *BlockState) AddCode(key types.AccountID, code []byte)
- func (bs *BlockState) AddReceipt(r *types.Receipt) error
- func (bs *BlockState) Consensus() []byte
- func (bs *BlockState) GetABI(key types.AccountID) *types.ABI
- func (bs *BlockState) GetCode(key types.AccountID) []byte
- func (bs *BlockState) PrevBlockHash() []byte
- func (bs *BlockState) Receipts() *types.Receipts
- func (bs *BlockState) RemoveCache(key types.AccountID)
- func (bs *BlockState) Rollback(bSnap BlockSnapshot) error
- func (bs *BlockState) SetConsensus(ch []byte)
- func (bs *BlockState) SetGasPrice(gasPrice *big.Int) *BlockState
- func (bs *BlockState) SetPrevBlockHash(prevHash []byte) *BlockState
- func (bs *BlockState) SetTimeoutTx(tx types.Transaction)
- func (bs *BlockState) Snapshot() BlockSnapshot
- func (bs *BlockState) TimeoutTx() types.Transaction
- type BlockStateOptFn
- type ChainStateDB
- func (sdb *ChainStateDB) Apply(bstate *BlockState) error
- func (sdb *ChainStateDB) Clone() *ChainStateDB
- func (sdb *ChainStateDB) Close() error
- func (sdb *ChainStateDB) GetRoot() []byte
- func (sdb *ChainStateDB) GetStateDB() *statedb.StateDB
- func (sdb *ChainStateDB) Init(dbType string, dataDir string, bestBlock *types.Block, test bool) error
- func (sdb *ChainStateDB) IsExistState(hash []byte) bool
- func (sdb *ChainStateDB) NewBlockState(root []byte, options ...BlockStateOptFn) *BlockState
- func (sdb *ChainStateDB) OpenNewStateDB(root []byte) *statedb.StateDB
- func (sdb *ChainStateDB) SetGenesis(genesis *types.Genesis, bpInit func(*statedb.StateDB, *types.Genesis) error) error
- func (sdb *ChainStateDB) SetRoot(targetBlockRoot []byte) error
- func (sdb *ChainStateDB) UpdateRoot(bstate *BlockState) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SendBalance ¶ added in v2.5.0
func SendBalance(sender, receiver *AccountState, amount *big.Int) error
Types ¶
type AccountState ¶ added in v2.5.0
type AccountState struct {
// contains filtered or unexported fields
}
func CreateAccountState ¶ added in v2.5.0
func CreateAccountState(id []byte, sdb *statedb.StateDB) (*AccountState, error)
func GetAccountState ¶ added in v2.5.0
func GetAccountState(id []byte, states *statedb.StateDB) (*AccountState, error)
func InitAccountState ¶ added in v2.5.0
func (*AccountState) AccountID ¶ added in v2.5.0
func (as *AccountState) AccountID() types.AccountID
func (*AccountState) AddBalance ¶ added in v2.5.0
func (as *AccountState) AddBalance(amount *big.Int)
func (*AccountState) Balance ¶ added in v2.5.0
func (as *AccountState) Balance() *big.Int
func (*AccountState) CodeHash ¶ added in v2.5.0
func (as *AccountState) CodeHash() []byte
func (*AccountState) ID ¶ added in v2.5.0
func (as *AccountState) ID() []byte
func (*AccountState) IDNoPadding ¶ added in v2.5.0
func (as *AccountState) IDNoPadding() []byte
func (*AccountState) IsContract ¶ added in v2.5.0
func (as *AccountState) IsContract() bool
func (*AccountState) IsDeploy ¶ added in v2.5.0
func (as *AccountState) IsDeploy() bool
func (*AccountState) IsNew ¶ added in v2.5.0
func (as *AccountState) IsNew() bool
func (*AccountState) IsRedeploy ¶ added in v2.5.0
func (as *AccountState) IsRedeploy() bool
func (*AccountState) Nonce ¶ added in v2.5.0
func (as *AccountState) Nonce() uint64
func (*AccountState) PutState ¶ added in v2.5.0
func (as *AccountState) PutState() error
func (*AccountState) RP ¶ added in v2.5.0
func (as *AccountState) RP() uint64
func (*AccountState) Reset ¶ added in v2.5.0
func (as *AccountState) Reset()
func (*AccountState) SetCodeHash ¶ added in v2.5.0
func (as *AccountState) SetCodeHash(codeHash []byte)
func (*AccountState) SetNonce ¶ added in v2.5.0
func (as *AccountState) SetNonce(nonce uint64)
func (*AccountState) SetRP ¶ added in v2.5.0
func (as *AccountState) SetRP(sqlRecoveryPoint uint64)
func (*AccountState) SetRedeploy ¶ added in v2.5.0
func (as *AccountState) SetRedeploy()
func (*AccountState) SetStorageRoot ¶ added in v2.5.0
func (as *AccountState) SetStorageRoot(storageRoot []byte)
func (*AccountState) State ¶ added in v2.5.0
func (as *AccountState) State() *types.State
func (*AccountState) StorageRoot ¶ added in v2.5.0
func (as *AccountState) StorageRoot() []byte
func (*AccountState) SubBalance ¶ added in v2.5.0
func (as *AccountState) SubBalance(amount *big.Int)
type BlockSnapshot ¶
type BlockSnapshot struct {
// contains filtered or unexported fields
}
type BlockState ¶
type BlockState struct { *statedb.StateDB BpReward big.Int // final bp reward, increment when tx executes CCProposal *consensus.ConfChangePropose GasPrice *big.Int // contains filtered or unexported fields }
BlockState contains BlockInfo and statedb for block
func NewBlockState ¶
func NewBlockState(states *statedb.StateDB, options ...BlockStateOptFn) *BlockState
NewBlockState create new blockState contains blockInfo, account states and undo states
func (*BlockState) AddReceipt ¶
func (bs *BlockState) AddReceipt(r *types.Receipt) error
func (*BlockState) Consensus ¶
func (bs *BlockState) Consensus() []byte
func (*BlockState) PrevBlockHash ¶
func (bs *BlockState) PrevBlockHash() []byte
func (*BlockState) Receipts ¶
func (bs *BlockState) Receipts() *types.Receipts
func (*BlockState) RemoveCache ¶
func (bs *BlockState) RemoveCache(key types.AccountID)
func (*BlockState) Rollback ¶
func (bs *BlockState) Rollback(bSnap BlockSnapshot) error
func (*BlockState) SetConsensus ¶
func (bs *BlockState) SetConsensus(ch []byte)
func (*BlockState) SetGasPrice ¶
func (bs *BlockState) SetGasPrice(gasPrice *big.Int) *BlockState
func (*BlockState) SetPrevBlockHash ¶
func (bs *BlockState) SetPrevBlockHash(prevHash []byte) *BlockState
func (*BlockState) SetTimeoutTx ¶
func (bs *BlockState) SetTimeoutTx(tx types.Transaction)
func (*BlockState) Snapshot ¶
func (bs *BlockState) Snapshot() BlockSnapshot
func (*BlockState) TimeoutTx ¶
func (bs *BlockState) TimeoutTx() types.Transaction
type BlockStateOptFn ¶
type BlockStateOptFn func(s *BlockState)
func SetGasPrice ¶
func SetGasPrice(gasPrice *big.Int) BlockStateOptFn
func SetPrevBlockHash ¶
func SetPrevBlockHash(h []byte) BlockStateOptFn
type ChainStateDB ¶
ChainStateDB manages statedb and additional informations about blocks like a state root hash
func NewChainStateDB ¶
func NewChainStateDB() *ChainStateDB
NewChainStateDB creates instance of ChainStateDB
func (*ChainStateDB) Apply ¶
func (sdb *ChainStateDB) Apply(bstate *BlockState) error
Apply specific blockstate to statedb of main chain
func (*ChainStateDB) Clone ¶
func (sdb *ChainStateDB) Clone() *ChainStateDB
Init initialize database and load statedb of latest block
func (*ChainStateDB) Close ¶
func (sdb *ChainStateDB) Close() error
Close saves latest block information of the chain
func (*ChainStateDB) GetRoot ¶
func (sdb *ChainStateDB) GetRoot() []byte
GetRoot returns state root hash
func (*ChainStateDB) GetStateDB ¶
func (sdb *ChainStateDB) GetStateDB() *statedb.StateDB
GetStateDB returns statedb stores account states
func (*ChainStateDB) Init ¶
func (sdb *ChainStateDB) Init(dbType string, dataDir string, bestBlock *types.Block, test bool) error
Init initialize database and load statedb of latest block
func (*ChainStateDB) IsExistState ¶
func (sdb *ChainStateDB) IsExistState(hash []byte) bool
func (*ChainStateDB) NewBlockState ¶
func (sdb *ChainStateDB) NewBlockState(root []byte, options ...BlockStateOptFn) *BlockState
func (*ChainStateDB) OpenNewStateDB ¶
func (sdb *ChainStateDB) OpenNewStateDB(root []byte) *statedb.StateDB
OpenNewStateDB returns new instance of statedb given state root hash
func (*ChainStateDB) SetGenesis ¶
func (*ChainStateDB) SetRoot ¶
func (sdb *ChainStateDB) SetRoot(targetBlockRoot []byte) error
func (*ChainStateDB) UpdateRoot ¶
func (sdb *ChainStateDB) UpdateRoot(bstate *BlockState) error
Click to show internal directories.
Click to hide internal directories.