Documentation ¶
Index ¶
- Constants
- func GetKeyBlock(height Height) []byte
- func GetKeyHeight() []byte
- func GetKeyMempoolHeight() []byte
- func GetKeyMempoolTX(hash Hash) []byte
- func GetKeyTX(hash Hash) []byte
- type Block
- type BlockT
- type Chain
- type ChainT
- func (chain *ChainT) Accept(block Block) bool
- func (chain *ChainT) Block(height Height) Block
- func (chain *ChainT) Close()
- func (chain *ChainT) Height() Height
- func (chain *ChainT) Mempool() Mempool
- func (chain *ChainT) Merge(height Height, txs []Transaction) bool
- func (chain *ChainT) Rollback(ptr uint64) bool
- func (chain *ChainT) TX(hash Hash) Transaction
- type Hash
- type Hasher
- type Height
- type Iterator
- type IteratorT
- type KeyValueDB
- type KeyValueDBT
- type Mempool
- type MempoolT
- type PrivKey
- type PubKey
- type Sign
- type Signifier
- type Transaction
- type TransactionT
- type Wrapper
Constants ¶
View Source
const ( KeySize = 1024 // num bits MempoolSize = 1000 // max num txs in mempool TXsSize = 32 // num txs in block PayloadSize = 1024 // num bytes in tx.payload BlocksPath = "blocks.db" TXsPath = "txs.db" MempoolPath = "mempool.db" KeyHeight = "chain.blocks.height" KeyBlock = "chain.blocks.block[%d]" KeyTX = "chain.txs.tx[%X]" KeyMempoolHeight = "chain.mempool.height" KeyMempoolTX = "chain.mempool.tx[%X]" KeyMempoolPrefixTX = "chain.mempool.tx[" )
Variables ¶
This section is empty.
Functions ¶
func GetKeyBlock ¶
func GetKeyHeight ¶
func GetKeyHeight() []byte
func GetKeyMempoolHeight ¶
func GetKeyMempoolHeight() []byte
func GetKeyMempoolTX ¶
Types ¶
type Block ¶
type Block interface { PrevHash() Hash Transactions() []Transaction Wrapper Hasher }
func NewBlock ¶
func NewBlock(prevHash []byte, txs []Transaction) Block
type BlockT ¶
type BlockT struct {
// contains filtered or unexported fields
}
func (*BlockT) Transactions ¶
func (block *BlockT) Transactions() []Transaction
type Chain ¶
type ChainT ¶
type ChainT struct {
// contains filtered or unexported fields
}
func (*ChainT) TX ¶
func (chain *ChainT) TX(hash Hash) Transaction
type KeyValueDB ¶
type KeyValueDB interface { Iter([]byte) Iterator Set([]byte, []byte) Get([]byte) []byte Del([]byte) Close() }
func NewDB ¶
func NewDB(path string) KeyValueDB
type KeyValueDBT ¶
type KeyValueDBT struct {
// contains filtered or unexported fields
}
func (*KeyValueDBT) Close ¶
func (db *KeyValueDBT) Close()
func (*KeyValueDBT) Del ¶
func (db *KeyValueDBT) Del(key []byte)
func (*KeyValueDBT) Get ¶
func (db *KeyValueDBT) Get(key []byte) []byte
func (*KeyValueDBT) Iter ¶
func (db *KeyValueDBT) Iter(prefix []byte) Iterator
func (*KeyValueDBT) Set ¶
func (db *KeyValueDBT) Set(key []byte, value []byte)
type Mempool ¶
type Mempool interface { Height() Height TX(Hash) Transaction Push(Transaction) Pop() []Transaction Delete(Hash) Clear() }
type MempoolT ¶
type MempoolT struct {
// contains filtered or unexported fields
}
func (*MempoolT) Pop ¶
func (mempool *MempoolT) Pop() []Transaction
func (*MempoolT) Push ¶
func (mempool *MempoolT) Push(tx Transaction)
func (*MempoolT) TX ¶
func (mempool *MempoolT) TX(hash Hash) Transaction
type Transaction ¶
func LoadTransaction ¶
func LoadTransaction(txbytes []byte) Transaction
func NewTransaction ¶
func NewTransaction(priv PrivKey, payLoad []byte) Transaction
type TransactionT ¶
type TransactionT struct {
// contains filtered or unexported fields
}
func (*TransactionT) Bytes ¶
func (tx *TransactionT) Bytes() []byte
func (*TransactionT) Hash ¶
func (tx *TransactionT) Hash() Hash
func (*TransactionT) IsValid ¶
func (tx *TransactionT) IsValid() bool
func (*TransactionT) PayLoad ¶
func (tx *TransactionT) PayLoad() []byte
func (*TransactionT) Sign ¶
func (tx *TransactionT) Sign() Sign
func (*TransactionT) String ¶
func (tx *TransactionT) String() string
func (*TransactionT) Validator ¶
func (tx *TransactionT) Validator() PubKey
Click to show internal directories.
Click to hide internal directories.