statedb

package
v0.0.0-...-868bdbc Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2020 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDB

func GetDB() *trie.Database

GetDB ...

func RegisterTrieAmino

func RegisterTrieAmino(cdc *amino.Codec)

RegisterTrieAmino ...

Types

type Account

type Account struct {
	Nonce                uint64
	Address              string
	PublicKey            string
	StateRoot            string
	AddressHash          cmn.HexBytes
	Balance              uint64
	Erc20Address         string
	LastBlockHeight      uint64
	ExternalNonce        uint64
	EBalances            map[string]map[string]EBalance
	FirstExternalAddress map[string]string
	LockedBalance        map[string]map[string]uint64
}

Account : Account Detail

type EBalance

type EBalance struct {
	Address         string
	Balance         uint64
	LastBlockHeight uint64
	Nonce           uint64
}

EBalance is external balance model

func (*EBalance) UpdateBalance

func (eb *EBalance) UpdateBalance(b uint64)

UpdateBalance sets EBalance's balance.

func (*EBalance) UpdateBlockHeight

func (eb *EBalance) UpdateBlockHeight(h uint64)

UpdateBlockHeight sets EBalance's last block height.

func (*EBalance) UpdateNonce

func (eb *EBalance) UpdateNonce(n uint64)

UpdateNonce sets EBalance's nonce.

type OldAccount

type OldAccount struct {
	Nonce           uint64
	Address         string
	PublicKey       string
	StateRoot       string
	AddressHash     cmn.HexBytes
	Balance         uint64
	Erc20Address    string
	LastBlockHeight uint64
	ExternalNonce   uint64
	EBalances       map[string]EBalance
}

type Trie

type Trie interface {
	TryGet(key []byte) ([]byte, error)
	TryUpdate(key, value []byte) error
	TryDelete(key []byte) error
	Commit(onleaf trie.LeafCallback) ([]byte, error)
	Hash() []byte //common.Hash
	NodeIterator(startKey []byte) trie.NodeIterator
	GetKey([]byte) []byte
}

Trie modified referring Ethereum Merkle Patricia Trie.

func GetState

func GetState(dir string) Trie

GetState return global singleton state.

func NewTrie

func NewTrie(hash common.Hash) (Trie, error)

NewTrie returns state which implements Trie interface

Jump to

Keyboard shortcuts

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