Documentation
¶
Index ¶
Constants ¶
View Source
const (
BufferSize = 4
)
Variables ¶
View Source
var Log = true
Functions ¶
func StatusToString ¶
func StatusToString(status VerificationStatus) string
Types ¶
type Block ¶
func NewBlock ¶
func NewBlock(tx *MerkleNode, prevBlock *Block) *Block
func (*Block) PrintBlock ¶
func (block *Block) PrintBlock()
type Chain ¶
type Chain struct {
Store DataStore
SeedHash []byte
Buffer []MerkleData
LatestBlock *Block
}
func (*Chain) PrintChain ¶
func (chain *Chain) PrintChain()
type DataStore ¶
type DataStore interface {
InsertTree(root *MerkleNode)
InsertBlock(block *Block)
InsertData(data []byte, txID string)
GetTree(hash []byte) *MerkleNode
GetBlock(hash []byte) *Block
GetData(txID string) []byte
}
type MerkleData ¶
type MerkleNode ¶
func NewMerkleTree ¶
func NewMerkleTree(data []MerkleData) *MerkleNode
func (*MerkleNode) Contains ¶
func (node *MerkleNode) Contains(txID string) bool
func (*MerkleNode) PrintRecursive ¶
func (node *MerkleNode) PrintRecursive(level int)
type VerificationStatus ¶
type VerificationStatus int
const ( InBuffer VerificationStatus = iota InBufferInvalid Invalid UnknownTxID Verified )
Click to show internal directories.
Click to hide internal directories.