Documentation ¶
Index ¶
- func CalculateRewards(logger log.Log, cfg RewardConfig, lid types.LayerID, totalFees uint64, ...) ([]*types.Reward, error)
- type RewardConfig
- type VM
- func (vm *VM) AddressExists(addr types.Address) (bool, error)
- func (vm *VM) ApplyLayer(lid types.LayerID, txs []*types.Transaction, rewards []types.AnyReward) ([]*types.Transaction, error)
- func (vm *VM) GetAllAccounts() ([]*types.Account, error)
- func (vm *VM) GetBalance(addr types.Address) (uint64, error)
- func (vm *VM) GetLayerApplied(tid types.TransactionID) (types.LayerID, error)
- func (vm *VM) GetLayerStateRoot(lid types.LayerID) (types.Hash32, error)
- func (vm *VM) GetNonce(addr types.Address) (uint64, error)
- func (vm *VM) GetStateRoot() (types.Hash32, error)
- func (vm *VM) Revert(lid types.LayerID) (types.Hash32, error)
- func (vm *VM) SetupGenesis(genesis *config.GenesisConfig) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type RewardConfig ¶
type RewardConfig struct {
BaseReward uint64 `mapstructure:"base-reward"`
}
RewardConfig defines the configuration options for Spacemesh rewards.
func DefaultRewardConfig ¶
func DefaultRewardConfig() RewardConfig
DefaultRewardConfig returns the default RewardConfig.
type VM ¶
type VM struct {
// contains filtered or unexported fields
}
VM manages accounts state.
func (*VM) AddressExists ¶
AddressExists checks if an account address exists in this node's global state.
func (*VM) ApplyLayer ¶
func (vm *VM) ApplyLayer(lid types.LayerID, txs []*types.Transaction, rewards []types.AnyReward) ([]*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 (*VM) GetAllAccounts ¶
GetAllAccounts returns a dump of all accounts in global state.
func (*VM) GetBalance ¶
GetBalance Retrieve the balance from the given address or 0 if object not found.
func (*VM) GetLayerApplied ¶
GetLayerApplied returns layer of the applied transaction.
func (*VM) GetLayerStateRoot ¶
GetLayerStateRoot returns the state root at a given layer.
func (*VM) GetNonce ¶
GetNonce gets the current nonce of the given addr, if the address is not found it returns 0.
func (*VM) GetStateRoot ¶
GetStateRoot gets the current state root hash.
func (*VM) Revert ¶
Revert all changes that we made after the layer. Returns state hash of the layer.
func (*VM) SetupGenesis ¶
func (vm *VM) SetupGenesis(genesis *config.GenesisConfig) error
SetupGenesis creates new accounts and adds balances as dictated by `conf`.