github.com/koko1123/flow-go-1@v0.29.6/storage/badger/operation/root_qc.go (about)

     1  package operation
     2  
     3  import (
     4  	"github.com/dgraph-io/badger/v3"
     5  
     6  	"github.com/koko1123/flow-go-1/model/flow"
     7  )
     8  
     9  // InsertRootQuorumCertificate inserts the root quorum certificate for the
    10  // local blockchain state. The root quorum certificate certifies the root
    11  // block and is used to bootstrap HotStuff.
    12  //
    13  // Only the root quorum certificate must be explicitly stored in this way!
    14  // All other quorum certificates are implicitly included in the child of
    15  // block they certify in the ParentSigs field.
    16  func InsertRootQuorumCertificate(qc *flow.QuorumCertificate) func(txn *badger.Txn) error {
    17  	return func(txn *badger.Txn) error {
    18  		return insert(makePrefix(codeRootQuorumCertificate), qc)(txn)
    19  	}
    20  }
    21  
    22  func RetrieveRootQuorumCertificate(qc *flow.QuorumCertificate) func(txn *badger.Txn) error {
    23  	return func(txn *badger.Txn) error {
    24  		return retrieve(makePrefix(codeRootQuorumCertificate), qc)(txn)
    25  	}
    26  }