Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyRelativeState(statePrev map[[64]byte]*protocol.Account, ...) (stateUpdated map[[64]byte]*protocol.Account)
- func BlockAlreadyInStash(slice []*protocol.Block, newBlockHash [32]byte) bool
- func CreateBucket(bucketName string, db *bolt.DB) (err error)
- func DeleteAccount(address [64]byte)
- func DeleteAll() (err error)
- func DeleteAllLastClosedBlock() error
- func DeleteAllLastClosedEpochBlock() error
- func DeleteBucket(bucketName string, db *bolt.DB) (err error)
- func DeleteClosedBlock(hash [32]byte) error
- func DeleteClosedEpochBlock(hash [32]byte) error
- func DeleteClosedTx(transaction protocol.Transaction) error
- func DeleteINVALIDOpenTx(transaction protocol.Transaction)
- func DeleteLastClosedBlock(hash [32]byte) error
- func DeleteOpenBlock(hash [32]byte) error
- func DeleteOpenEpochBlock(hash [32]byte) error
- func DeleteOpenTx(transaction protocol.Transaction)
- func GetContractTxPubKeys(contractTxData [][32]byte) (contractTxPubKeys [][64]byte)
- func GetFundsTxPubKeys(fundsTxData [][32]byte) (fundsTxPubKeys [][64]byte)
- func GetMemPoolSize() int
- func GetRelativeState(statePrev map[[64]byte]protocol.Account, ...) (stateRel map[[64]byte]*protocol.RelativeAccount)
- func GetTxPubKeys(block *protocol.Block) (txPubKeys [][64]byte)
- func Init(dbname string, bootstrapIpport string) error
- func InitFileLogger() *log.Logger
- func InitLogger() *log.Logger
- func IsRootKey(pubKey [64]byte) bool
- func ReadAccount(pubKey [64]byte) (acc *protocol.Account, err error)
- func ReadAllClosedBlocks() (allClosedBlocks []*protocol.Block)
- func ReadAllOpenTxs() (allOpenTxs []protocol.Transaction)
- func ReadBlockFromOwnStash(height int) *protocol.Block
- func ReadClosedBlock(hash [32]byte) (block *protocol.Block)
- func ReadClosedEpochBlock(hash [32]byte) (epochBlock *protocol.EpochBlock)
- func ReadClosedTx(hash [32]byte) (transaction protocol.Transaction)
- func ReadFirstEpochBlock() (firstEpochBlock *protocol.EpochBlock, err error)
- func ReadGenesis() (genesis *protocol.Genesis, err error)
- func ReadINVALIDOpenTx(hash [32]byte) (transaction protocol.Transaction)
- func ReadLastClosedBlock() (block *protocol.Block)
- func ReadLastClosedEpochBlock() (epochBlock *protocol.EpochBlock)
- func ReadOpenBlock(hash [32]byte) (block *protocol.Block)
- func ReadOpenEpochBlock(hash [32]byte) (epochBlock *protocol.EpochBlock)
- func ReadOpenTx(hash [32]byte) (transaction protocol.Transaction)
- func ReadReceivedBlockStash() (receivedBlocks []*protocol.Block)
- func ReadRootAccount(pubKey [64]byte) (acc *protocol.Account, err error)
- func ReadStateTransitionFromOwnStash(height int) *protocol.StateTransition
- func TearDown()
- func WriteAccount(account *protocol.Account)
- func WriteClosedBlock(block *protocol.Block) error
- func WriteClosedEpochBlock(epochBlock *protocol.EpochBlock) error
- func WriteClosedTx(transaction protocol.Transaction) error
- func WriteFirstEpochBlock(epochBlock *protocol.EpochBlock) error
- func WriteGenesis(genesis *protocol.Genesis) error
- func WriteINVALIDOpenTx(transaction protocol.Transaction)
- func WriteLastClosedBlock(block *protocol.Block) (err error)
- func WriteLastClosedEpochBlock(epochBlock *protocol.EpochBlock) (err error)
- func WriteOpenBlock(block *protocol.Block) error
- func WriteOpenEpochBlock(epochBlock *protocol.EpochBlock) error
- func WriteOpenTx(transaction protocol.Transaction)
- func WriteToOwnBlockStash(block *protocol.Block)
- func WriteToOwnStateTransitionkStash(st *protocol.StateTransition)
- func WriteToReceivedStash(block *protocol.Block)
Constants ¶
View Source
const ( ERROR_MSG = "Storage initialization aborted. Reason: " OPENBLOCKS_BUCKET = "openblocks" CLOSEDBLOCKS_BUCKET = "closedblocks" CLOSEDFUNDS_BUCKET = "closedfunds" CLOSEDACCS_BUCKET = "closedaccs" CLOSEDSTAKES_BUCKET = "closedstakes" CLOSEDCONFIGS_BUCKET = "closedconfigs" LASTCLOSEDBLOCK_BUCKET = "lastclosedblock" GENESIS_BUCKET = "genesis" CLOSEDEPOCHBLOCK_BUCKET = "closedepochblocks" LASTCLOSEDEPOCHBLOCK_BUCKET = "lastclosedepochblocks" OPENEPOCHBLOCK_BUCKET = "openepochblock" )
Variables ¶
View Source
var ( State = make(map[[64]byte]*protocol.Account) //This map keeps track of the relative account adjustments within a shard, such as balance, txcount and stakingheight RelativeState = make(map[[64]byte]*protocol.RelativeAccount) RootKeys = make(map[[64]byte]*protocol.Account) ReceivedStateStash = protocol.NewStateStash() OwnBlockStash []*protocol.Block OwnStateTransitionStash []*protocol.StateTransition AllClosedBlocksAsc []*protocol.Block BootstrapServer string Buckets []string ThisShardID int // ID of the shard this validator is assigned to ReceivedBlockStash = make([]*protocol.Block, 0) )
Functions ¶
func ApplyRelativeState ¶
func BlockAlreadyInStash ¶
func DeleteAccount ¶
func DeleteAccount(address [64]byte)
func DeleteAllLastClosedBlock ¶
func DeleteAllLastClosedBlock() error
func DeleteAllLastClosedEpochBlock ¶
func DeleteAllLastClosedEpochBlock() error
func DeleteClosedBlock ¶
func DeleteClosedEpochBlock ¶
func DeleteClosedTx ¶
func DeleteClosedTx(transaction protocol.Transaction) error
func DeleteINVALIDOpenTx ¶
func DeleteINVALIDOpenTx(transaction protocol.Transaction)
func DeleteLastClosedBlock ¶
func DeleteOpenBlock ¶
There exist open/closed buckets and closed tx buckets for all types (open txs are in volatile storage)
func DeleteOpenEpochBlock ¶
func DeleteOpenTx ¶
func DeleteOpenTx(transaction protocol.Transaction)
func GetContractTxPubKeys ¶
Get all pubKey involved in ContractTx
func GetFundsTxPubKeys ¶
Get all pubKey involved in FundsTx
func GetMemPoolSize ¶
func GetMemPoolSize() int
func GetRelativeState ¶
func GetTxPubKeys ¶
Get all pubKeys involved in ContractTx, FundsTx of a given block
func InitFileLogger ¶
func InitLogger ¶
func ReadAllClosedBlocks ¶
func ReadAllOpenTxs ¶
func ReadAllOpenTxs() (allOpenTxs []protocol.Transaction)
Needed for the miner to prepare a new block
func ReadBlockFromOwnStash ¶
func ReadClosedBlock ¶
func ReadClosedEpochBlock ¶
func ReadClosedEpochBlock(hash [32]byte) (epochBlock *protocol.EpochBlock)
func ReadClosedTx ¶
func ReadClosedTx(hash [32]byte) (transaction protocol.Transaction)
Personally I like it better to test (which tx type it is) here, and get returned the interface. Simplifies the code
func ReadFirstEpochBlock ¶
func ReadFirstEpochBlock() (firstEpochBlock *protocol.EpochBlock, err error)
func ReadGenesis ¶
func ReadINVALIDOpenTx ¶
func ReadINVALIDOpenTx(hash [32]byte) (transaction protocol.Transaction)
func ReadLastClosedBlock ¶
func ReadLastClosedEpochBlock ¶
func ReadLastClosedEpochBlock() (epochBlock *protocol.EpochBlock)
func ReadOpenBlock ¶
Always return nil if requested hash is not in the storage. This return value is then checked against by the caller
func ReadOpenEpochBlock ¶
func ReadOpenEpochBlock(hash [32]byte) (epochBlock *protocol.EpochBlock)
func ReadOpenTx ¶
func ReadOpenTx(hash [32]byte) (transaction protocol.Transaction)
func ReadReceivedBlockStash ¶
func ReadStateTransitionFromOwnStash ¶
func ReadStateTransitionFromOwnStash(height int) *protocol.StateTransition
func WriteAccount ¶
func WriteClosedBlock ¶
func WriteClosedEpochBlock ¶
func WriteClosedEpochBlock(epochBlock *protocol.EpochBlock) error
func WriteClosedTx ¶
func WriteClosedTx(transaction protocol.Transaction) error
func WriteFirstEpochBlock ¶
func WriteFirstEpochBlock(epochBlock *protocol.EpochBlock) error
func WriteGenesis ¶
func WriteINVALIDOpenTx ¶
func WriteINVALIDOpenTx(transaction protocol.Transaction)
func WriteLastClosedBlock ¶
func WriteLastClosedEpochBlock ¶
func WriteLastClosedEpochBlock(epochBlock *protocol.EpochBlock) (err error)
func WriteOpenBlock ¶
func WriteOpenEpochBlock ¶
func WriteOpenEpochBlock(epochBlock *protocol.EpochBlock) error
func WriteOpenTx ¶
func WriteOpenTx(transaction protocol.Transaction)
Changing the "tx" shortcut here and using "transaction" to distinguish between bolt's transactions
func WriteToOwnBlockStash ¶
func WriteToOwnStateTransitionkStash ¶
func WriteToOwnStateTransitionkStash(st *protocol.StateTransition)
func WriteToReceivedStash ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.