Skip to content

8 Validator And Committer

Senthilnathan Natarajan edited this page May 27, 2020 · 2 revisions

Validator and Committer

type ValidatorAndCommitter struct {
     blockQueue        BlockQueue
     validator         Validator
     stateDB           StateDB
     provenanceDB      ProvenanceDB
     blockStore        BlockStore
     merkleTreeBuilder MerkleTreeBuilder
}

type validator struct {
     dependencyGraph DependencyGraph
     stateDB         StateDB
}

type Validator interface {
     ConstructDependencyGraph(block *pb.Block)
     ValidTransactionWrites(txs []*pb.Transaction) ([]*Writes, error)
}

StateDB

type stateDB sturct {
     db *leveldb
     mu sync.RWMutex
}

type StateDB interface {
	 GetVersion(key string) (version, error)
	 WriteBatch(batch *leveldb.Batch, sync bool) error
}

Provenance DB

type provenanceDB sturct {
     db *leveldb
     mu sync.RWMutex
}

type ProvenanceDB interface {
     PutMerkleTree(tree MerkleTree) error
     WriteBatch(batch *leveldb.Batch, sync bool) error
}

Block Store

type blockStore sturct {
     fileBasedStore FileStore
     mu sync.RWMutex
}

type BlockStore interface {
     AddBlock(block *pb.Block) error
}