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