Documentation
¶
Index ¶
- type Application
- func (a *Application) ApplyState(txn *badger.Txn, chainID uint32, height uint32, txs []interfaces.Transaction) (stateHash []byte, err error)
- func (a *Application) BeginSnapShotSync(txn *badger.Txn) error
- func (a *Application) Cleanup() error
- func (a *Application) FinalizeSnapShotRoot(txn *badger.Txn, root []byte, height uint32) error
- func (a *Application) FinalizeSync(txn *badger.Txn) error
- func (a *Application) GetHeightForTx(txn *badger.Txn, txHash []byte) (uint32, error)
- func (a *Application) GetSnapShotNode(txn *badger.Txn, height uint32, key []byte) ([]byte, error)
- func (a *Application) GetSnapShotStateData(txn *badger.Txn, utxoID []byte) ([]byte, error)
- func (a *Application) GetTxsForGossip(txnState *badger.Txn, currentHeight uint32) ([]interfaces.Transaction, error)
- func (a *Application) GetValidProposal(txn *badger.Txn, chainID, height, maxBytes uint32) ([]interfaces.Transaction, []byte, error)
- func (a *Application) GetValueForOwner(txn *badger.Txn, curveSpec constants.CurveSpec, account []byte, ...) ([][]byte, *uint256.Uint256, error)
- func (a *Application) Init(conDB *consensusdb.Database, memDB *badger.DB, dph *deposit.Handler) error
- func (a *Application) IsValid(txn *badger.Txn, chainID uint32, height uint32, stateHash []byte, ...) (bool, error)
- func (a *Application) MinedTxGet(txn *badger.Txn, txHash [][]byte) ([]interfaces.Transaction, [][]byte, error)
- func (a *Application) PaginateDataByOwner(txn *badger.Txn, curveSpec constants.CurveSpec, account []byte, height uint32, ...) ([]*objs.PaginationResponse, error)
- func (a *Application) PendingTxAdd(txn *badger.Txn, chainID uint32, height uint32, txs []interfaces.Transaction) error
- func (a *Application) PendingTxContains(txn *badger.Txn, height uint32, txHashes [][]byte) ([][]byte, error)
- func (a *Application) PendingTxGet(txn *badger.Txn, height uint32, txHashes [][]byte) ([]interfaces.Transaction, [][]byte, error)
- func (a *Application) SetMiningKey(privKey []byte, curveSpec constants.CurveSpec) error
- func (a *Application) StoreSnapShotNode(txn *badger.Txn, batch []byte, root []byte, layer int) ([][]byte, int, []trie.LeafNode, error)
- func (a *Application) StoreSnapShotStateData(txn *badger.Txn, key []byte, value []byte, data []byte) error
- func (a *Application) UTXOContains(txn *badger.Txn, utxoID []byte) (bool, error)
- func (a *Application) UTXOGet(txn *badger.Txn, utxoIDs [][]byte) ([]*objs.TXOut, error)
- func (a *Application) UTXOGetData(txn *badger.Txn, curveSpec constants.CurveSpec, account []byte, dataIdx []byte) ([]byte, error)
- func (a *Application) UnmarshalTx(txb []byte) (interfaces.Transaction, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
Application ...
func (*Application) ApplyState ¶
func (a *Application) ApplyState(txn *badger.Txn, chainID uint32, height uint32, txs []interfaces.Transaction) (stateHash []byte, err error)
ApplyState is a function that returns a list of transactions that will cause a valid state transition function for the local node's current state. This is the function used to create a new proposal. comes from application logic
func (*Application) BeginSnapShotSync ¶
func (a *Application) BeginSnapShotSync(txn *badger.Txn) error
BeginSnapShotSync drops all pending txs and state data before fast sync
func (*Application) Cleanup ¶
func (a *Application) Cleanup() error
Cleanup does nothing at this time
func (*Application) FinalizeSnapShotRoot ¶
func (a *Application) FinalizeSnapShotRoot(txn *badger.Txn, root []byte, height uint32) error
FinalizeSnapShotRoot will complete a snapshot fast sync by setting the trie root lookupkeys for the state trie
func (*Application) FinalizeSync ¶
func (a *Application) FinalizeSync(txn *badger.Txn) error
FinalizeSync will finalize state after a fast sync
func (*Application) GetHeightForTx ¶
func (a *Application) GetHeightForTx(txn *badger.Txn, txHash []byte) (uint32, error)
GetHeightForTx returns the height at which a tx was mined
func (*Application) GetSnapShotNode ¶
func (a *Application) GetSnapShotNode(txn *badger.Txn, height uint32, key []byte) ([]byte, error)
GetSnapShotNode will return a node from the state trie
func (*Application) GetSnapShotStateData ¶
func (a *Application) GetSnapShotStateData(txn *badger.Txn, utxoID []byte) ([]byte, error)
GetSnapShotStateData will return a UTXO for snapshot fast sync
func (*Application) GetTxsForGossip ¶
func (a *Application) GetTxsForGossip(txnState *badger.Txn, currentHeight uint32) ([]interfaces.Transaction, error)
GetTxsForGossip returns a list of transactions that should be gossipped
func (*Application) GetValidProposal ¶
func (a *Application) GetValidProposal(txn *badger.Txn, chainID, height, maxBytes uint32) ([]interfaces.Transaction, []byte, error)
GetValidProposal is a function that returns a list of transactions that will cause a valid state transition function for the local node's current state. This is the function used to create a new proposal. comes from application logic
func (*Application) GetValueForOwner ¶
func (*Application) Init ¶
func (a *Application) Init(conDB *consensusdb.Database, memDB *badger.DB, dph *deposit.Handler) error
Init initializes Application ...
func (*Application) IsValid ¶
func (a *Application) IsValid(txn *badger.Txn, chainID uint32, height uint32, stateHash []byte, txi []interfaces.Transaction) (bool, error)
IsValid returns true if the list of transactions is a valid transformation and false if the list is not valid. If an error is returned, it indicates a low level failure that should stop the main loop.
func (*Application) MinedTxGet ¶
func (a *Application) MinedTxGet(txn *badger.Txn, txHash [][]byte) ([]interfaces.Transaction, [][]byte, error)
MinedTxGet returns a list of mined transactions and a list of missing transaction hashes for mined transactions
func (*Application) PaginateDataByOwner ¶
func (a *Application) PaginateDataByOwner(txn *badger.Txn, curveSpec constants.CurveSpec, account []byte, height uint32, numItems int, startIndex []byte) ([]*objs.PaginationResponse, error)
PaginateDataByOwner returns a list of UTXOIDs and indexes from an account namespace
func (*Application) PendingTxAdd ¶
func (a *Application) PendingTxAdd(txn *badger.Txn, chainID uint32, height uint32, txs []interfaces.Transaction) error
PendingTxAdd adds a transaction to the txPool and cleans up any stale tx as a result.
func (*Application) PendingTxContains ¶
func (a *Application) PendingTxContains(txn *badger.Txn, height uint32, txHashes [][]byte) ([][]byte, error)
PendingTxContains returns a list of missing transaction hashes from the pending tx pool
func (*Application) PendingTxGet ¶
func (a *Application) PendingTxGet(txn *badger.Txn, height uint32, txHashes [][]byte) ([]interfaces.Transaction, [][]byte, error)
PendingTxGet returns a list of transactions and a list of missing transaction hashes from the pending transaction pool
func (*Application) SetMiningKey ¶
func (a *Application) SetMiningKey(privKey []byte, curveSpec constants.CurveSpec) error
SetMiningKey updates the mining key. This key is used for collecting block mining rewards/fees.
func (*Application) StoreSnapShotNode ¶
func (a *Application) StoreSnapShotNode(txn *badger.Txn, batch []byte, root []byte, layer int) ([][]byte, int, []trie.LeafNode, error)
StoreSnapShotNode will store a node of the state trie during fast sync
func (*Application) StoreSnapShotStateData ¶
func (a *Application) StoreSnapShotStateData(txn *badger.Txn, key []byte, value []byte, data []byte) error
StoreSnapShotStateData stores fast sync state
func (*Application) UTXOContains ¶
func (a *Application) UTXOContains(txn *badger.Txn, utxoID []byte) (bool, error)
UTXOContains returns true if the passed UTXOID is known and associated with a UTXO
func (*Application) UTXOGet ¶
func (a *Application) UTXOGet(txn *badger.Txn, utxoIDs [][]byte) ([]*objs.TXOut, error)
UTXOGet returns a list of UTXO objects
func (*Application) UTXOGetData ¶
func (a *Application) UTXOGetData(txn *badger.Txn, curveSpec constants.CurveSpec, account []byte, dataIdx []byte) ([]byte, error)
UTXOGetData returns the data from a DataStore UTXO
func (*Application) UnmarshalTx ¶
func (a *Application) UnmarshalTx(txb []byte) (interfaces.Transaction, error)
UnmarshalTx allows a transaction to be unmarshalled into a transaction interface for use by the consensus algorithm