statedbhelper

package
v0.0.0-...-24d451d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdapterGetCallBack

func AdapterGetCallBack(transID, txID int64, key string) ([]byte, error)

AdapterGetCallBack callback of get function

func AdapterSetCallBack

func AdapterSetCallBack(transID, txID int64, data map[string][]byte) (*bool, error)

AdapterSetCallBack callback of set function

func AddAccountToken

func AddAccountToken(transID, txID int64, addr, token types.Address)

func BalanceOf

func BalanceOf(transID, txID int64, addr types.Address, token types.Address) bn.Number

BalanceOf gets account's balance of given token

func BeginBlock

func BeginBlock(transID int64)

BeginBlock a fake beginblock() for checkTx

func CheckAccountNonce

func CheckAccountNonce(transID, txID int64, exAddr types.Address, nonce uint64) error

CheckAccountNonce check account's nonce

func CheckBVMEnable

func CheckBVMEnable(transID, txID int64) bool

func CheckBlackList

func CheckBlackList(transID, txID int64, addr types.Address) bool

CheckBlackList check if an address is in black list

func CheckContractAddr

func CheckContractAddr(transID, txID int64, addr string) bool

CheckContractAddr check contract is valid or not

func CheckOrgInfo

func CheckOrgInfo(transID, txID int64, orgID, orgAddr string) bool

CheckOrgInfo check org address

func CommitBlock

func CommitBlock(transID int64)

CommitBlock commit block changes

func CommitTx

func CommitTx(transID, txID int64) ([]byte, map[string][]byte)

CommitTx commit tx changes

func CommitTx2V1

func CommitTx2V1(transID int64, txBuffer map[string][]byte)

CommitTx2V2 commit tx changes

func Get

func Get(transID, txID int64, key string) ([]byte, error)

func GetChainGenesisVersion

func GetChainGenesisVersion() int

func GetChainID

func GetChainID() string

func GetContract

func GetContract(contractAddr types.Address) *std.Contract

GetContract get specified contract data with contract address

func GetContractCodeHash

func GetContractCodeHash(transID, txID int64, contractAddr types.Address) []byte

GetContractCodeHash get contract code hash

func GetContractMeta

func GetContractMeta(transID, txID int64, contractAddr types.Address) std.ContractMeta

GetContractMeta get contract code

func GetContracts

func GetContracts(transID, txID int64, orgID string) []types.Address

GetContracts get contracts of org

func GetContractsByName

func GetContractsByName(transID, txID int64, name, orgID string) []types.Address

func GetContractsWithHeight

func GetContractsWithHeight(transID, txID, height int64) (contractAddrs []std.ContractWithEffectHeight)

func GetEffectContractByName

func GetEffectContractByName(transID, txID, height int64, name, orgID string) *std.Contract

func GetFromDB

func GetFromDB(key string) ([]byte, error)

func GetGasPriceRatio

func GetGasPriceRatio(transID, txID int64) string

func GetGenesisContractAddr

func GetGenesisContractAddr(transID, txID int64) types.Address

GetGenesisContractAddr Get genesis contract address

func GetGenesisOrgID

func GetGenesisOrgID(transID, txID int64) string

func GetGenesisToken

func GetGenesisToken() *std.Token

GetGenesisToken get genesis token of block chain

func GetMineContract

func GetMineContract(transID, txID int64) (mineContract []std.MineContract)

func GetOrgCodeHash

func GetOrgCodeHash(transID, txID int64, orgID string) []byte

GetOrgCodeHash get org code hash

func GetOrgID

func GetOrgID(transID, txID int64, contractAddr types.Address) string

func GetOrgSigners

func GetOrgSigners(transID, txID int64, orgID string) []types2.PubKey

func GetTokenByAddress

func GetTokenByAddress(transID, txID int64, addr types.Address) *std.Token

func GetWorldAppState

func GetWorldAppState(transID, txID int64) *abci.AppState

func Init

func Init(sdbName string, maxSnapshotCount int)

func KeyOfAccount

func KeyOfAccount(exAddress types.Address) string

func KeyOfAccountNonce

func KeyOfAccountNonce(exAddress types.Address) string

func KeyOfAccountToken

func KeyOfAccountToken(exAddress types.Address, contractAddr types.Address) string

func KeyOfToken

func KeyOfToken(tokenAddr types.Address) string

func NewCommittableTransactionID

func NewCommittableTransactionID() (int64, *statedb.Transaction)

NewCommittableTransactionID create a committable transaction and return ID

func NewRollbackTransactionID

func NewRollbackTransactionID() (int64, *statedb.Transaction)

NewRollbackTransactionID create a rollback transaction and return ID

func NewTx

func NewTx(transID int64) int64

func RollbackBlock

func RollbackBlock(transID int64)

RollbackBlock rollback block changes

func RollbackStateDB

func RollbackStateDB(rollbackTransactions int)

func RollbackTx

func RollbackTx(transID, txID int64)

RollbackTx rollback tx changes

func Set

func Set(transID, txID int64, key string, value []byte)

func SetAccountNonce

func SetAccountNonce(transID, txID int64, exAddress types.Address, nonce uint64) (nonceBuffer map[string][]byte, err error)

SetAccountNonce DeliverTx需要调用此接口检查并设置nonce。设置的nonce不会因为RollbackTx而取消。

func SetBalance

func SetBalance(transID, txID int64, addr types.Address, token types.Address, value bn.Number)

SetBalance set account's balance of given token to given value

func SetChainIDOnce

func SetChainIDOnce(cID string)

func SetContract

func SetContract(transID, txID int64, contract *std.Contract)

func SetContractMeta

func SetContractMeta(transID, txID int64, contract *std.ContractMeta)

func SetContractVersionList

func SetContractVersionList(transID, txID int64, orgID string, vl *std.ContractVersionList)

func SetGenesisContractAddr

func SetGenesisContractAddr(transID, txID int64, addr types.Address)

SetGenesisContractAddr set genesis contract address to statedb

func SetMineContract

func SetMineContract(transID, txID int64, mines []std.MineContract)

func SetOrganization

func SetOrganization(transID, txID int64, org *std.Organization)

func SetWorldAppState

func SetWorldAppState(transID, txID int64, appState *abci.AppState)

SetWorldAppState set data of app state

Types

type RewardStrategy

type RewardStrategy struct {
	Strategy     []Rewarder `json:"rewardStrategy,omitempty"` //奖励策略
	EffectHeight int64      `json:"effectHeight,omitempty"`   //生效高度
}

RewardStrategy struct of reward strategy

type Rewarder

type Rewarder struct {
	Name          string `json:"name"`          // 被奖励者名称
	RewardPercent string `json:"rewardPercent"` // 奖励比例
	Address       string `json:"address"`       // 被奖励者地址
}

Rewarder declare reward information

func GetRewardStrategy

func GetRewardStrategy(transID, txID int64, blockHeight int64) []Rewarder

RewardStrategy gets reward strategy of chain

func (*Rewarder) String

func (r *Rewarder) String() string

type Trans

type Trans struct {
	Transaction *statedb.Transaction
	TxMap       map[int64]*statedb.Tx // txID => *statedb2.Tx
}

type Validator

type Validator struct {
	PubKey     types.PubKey `json:"nodepubkey,omitempty"` //节点公钥
	Power      int64        `json:"power,omitempty"`      //节点记账权重
	RewardAddr string       `json:"rewardaddr,omitempty"` //节点接收奖励的地址
	Name       string       `json:"name,omitempty"`       //节点名称
	NodeAddr   string       `json:"nodeaddr,omitempty"`   //节点地址
}

Validator data struct of validator

func GetAllValidators

func GetAllValidators(transID, txID int64) []Validator

GetAllValidators get all validators information

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL