github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/storage/badger/operation/qcs.go (about) 1 package operation 2 3 import ( 4 "github.com/dgraph-io/badger/v2" 5 6 "github.com/onflow/flow-go/model/flow" 7 ) 8 9 // InsertQuorumCertificate inserts a quorum certificate by block ID. 10 // Returns storage.ErrAlreadyExists if a QC has already been inserted for the block. 11 func InsertQuorumCertificate(qc *flow.QuorumCertificate) func(*badger.Txn) error { 12 return insert(makePrefix(codeBlockIDToQuorumCertificate, qc.BlockID), qc) 13 } 14 15 // RetrieveQuorumCertificate retrieves a quorum certificate by blockID. 16 // Returns storage.ErrNotFound if no QC is stored for the block. 17 func RetrieveQuorumCertificate(blockID flow.Identifier, qc *flow.QuorumCertificate) func(*badger.Txn) error { 18 return retrieve(makePrefix(codeBlockIDToQuorumCertificate, blockID), qc) 19 }