Documentation ¶
Index ¶
- type SVM
- func (svm *SVM) AddressExists(addr types.Address) bool
- func (svm *SVM) ApplyLayer(layerID types.LayerID, transactions []*types.Transaction, ...) ([]*types.Transaction, error)
- func (svm *SVM) GetAllAccounts() (*types.MultipleAccountsState, error)
- func (svm *SVM) GetBalance(addr types.Address) uint64
- func (svm *SVM) GetLayerApplied(txID types.TransactionID) *types.LayerID
- func (svm *SVM) GetLayerStateRoot(layer types.LayerID) (types.Hash32, error)
- func (svm *SVM) GetNonce(addr types.Address) uint64
- func (svm *SVM) GetStateRoot() types.Hash32
- func (svm *SVM) Rewind(layer types.LayerID) (types.Hash32, error)
- func (svm *SVM) SetupGenesis(conf *config.GenesisConfig) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SVM ¶
type SVM struct {
// contains filtered or unexported fields
}
SVM is an entry point for all SVM operations.
func (*SVM) AddressExists ¶
AddressExists checks if an account address exists in this node's global state.
func (*SVM) ApplyLayer ¶
func (svm *SVM) ApplyLayer(layerID types.LayerID, transactions []*types.Transaction, rewards map[types.Address]uint64) ([]*types.Transaction, error)
ApplyLayer applies the given rewards to some miners as well as a vector of transactions for the given layer. to miners vector for layer. It returns an error on failure, as well as a vector of failed transactions.
func (*SVM) GetAllAccounts ¶
func (svm *SVM) GetAllAccounts() (*types.MultipleAccountsState, error)
GetAllAccounts returns a dump of all accounts in global state.
func (*SVM) GetBalance ¶
GetBalance Retrieve the balance from the given address or 0 if object not found.
func (*SVM) GetLayerApplied ¶
func (svm *SVM) GetLayerApplied(txID types.TransactionID) *types.LayerID
GetLayerApplied gets the layer id at which this tx was applied.
func (*SVM) GetLayerStateRoot ¶
GetLayerStateRoot returns the state root at a given layer.
func (*SVM) GetNonce ¶
GetNonce gets the current nonce of the given addr, if the address is not found it returns 0.
func (*SVM) GetStateRoot ¶
GetStateRoot gets the current state root hash.
func (*SVM) Rewind ¶
Rewind loads the given layer state from persistent storage. On success, it also returns the current state root hash *after* rewinding.
func (*SVM) SetupGenesis ¶
func (svm *SVM) SetupGenesis(conf *config.GenesisConfig) error
SetupGenesis creates new accounts and adds balances as dictated by `conf`.