Documentation ¶
Index ¶
- type BlockStorer
- type Chain
- func (c *Chain) AddBlock(block *proto.Block) error
- func (c *Chain) GetBlockByHash(hash []byte) (*proto.Block, error)
- func (c *Chain) GetBlockByHeight(height int) (*proto.Block, error)
- func (c *Chain) Height() int
- func (c *Chain) ValidateBlock(block *proto.Block) error
- func (c *Chain) ValidateTransaction(tx *proto.Transaction) error
- type HeaderList
- type MemoryBlockStore
- type MemoryTXStore
- type MemoryUTXOStore
- type Mempool
- type Node
- type ServerConfig
- type TXStorer
- type UTXO
- type UTXOStorer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockStorer ¶
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
func NewChain ¶
func NewChain(blockStore BlockStorer, txStore TXStorer) *Chain
func (*Chain) ValidateTransaction ¶
func (c *Chain) ValidateTransaction(tx *proto.Transaction) error
type HeaderList ¶
type HeaderList struct {
// contains filtered or unexported fields
}
func NewHeaderList ¶
func NewHeaderList() *HeaderList
func (*HeaderList) Add ¶
func (h *HeaderList) Add(header *proto.Header)
func (*HeaderList) Height ¶
func (h *HeaderList) Height() int
func (*HeaderList) Len ¶
func (h *HeaderList) Len() int
type MemoryBlockStore ¶
type MemoryBlockStore struct {
// contains filtered or unexported fields
}
func NewMemoryBlockStore ¶
func NewMemoryBlockStore() *MemoryBlockStore
type MemoryTXStore ¶
type MemoryTXStore struct {
// contains filtered or unexported fields
}
func NewMemoryTXStore ¶
func NewMemoryTXStore() *MemoryTXStore
func (*MemoryTXStore) Get ¶
func (m *MemoryTXStore) Get(hash string) (*proto.Transaction, error)
func (*MemoryTXStore) Put ¶
func (m *MemoryTXStore) Put(tx *proto.Transaction) error
type MemoryUTXOStore ¶
type MemoryUTXOStore struct {
// contains filtered or unexported fields
}
func NewMemoryUTXOStore ¶
func NewMemoryUTXOStore() *MemoryUTXOStore
func (*MemoryUTXOStore) Put ¶
func (m *MemoryUTXOStore) Put(utxo *UTXO) error
type Mempool ¶
type Mempool struct {
// contains filtered or unexported fields
}
func NewMempool ¶
func NewMempool() *Mempool
func (*Mempool) Clear ¶
func (m *Mempool) Clear() []*proto.Transaction
type Node ¶
type Node struct { ServerConfig proto.UnimplementedNodeServer // contains filtered or unexported fields }
func NewNode ¶
func NewNode(cfg ServerConfig) *Node
func (*Node) HandleTransaction ¶
type ServerConfig ¶
type ServerConfig struct { Version string ListenAddr string PrivateKey *crypto.PrivateKey }
type TXStorer ¶
type TXStorer interface { Put(*proto.Transaction) error Get(string) (*proto.Transaction, error) }
Click to show internal directories.
Click to hide internal directories.