@@ -6,17 +6,23 @@ import (
66)
77
88// IndexSporkRootBlock indexes the spork root block ID for the present spork.
9+ // A Node's state is strictly tied to a specific spork, and should never change during
10+ // the lifetime of the node. This values is inserted exactly once when bootstrapping the
11+ // state and should always be present for a properly bootstrapped node.
12+ // CAUTION: OVERWRITES existing data (potential for data corruption).
13+ // TODO: error if key already exists!
914//
10- // Error returns:
11- // - generic error in case of unexpected failure from the database layer or encoding failure.
15+ // No errors are expected during normal operation.
1216func IndexSporkRootBlock (w storage.Writer , blockID flow.Identifier ) error {
1317 return UpsertByKey (w , MakePrefix (codeSporkRootBlockID ), blockID )
1418}
1519
16- // RetrieveSporkRootBlockID retrieves the spork root block ID for the present spork.
17- //
18- // Error returns:
19- // - generic error in case of unexpected failure from the database layer or encoding failure.
20+ // RetrieveSporkRootBlockID retrieves the spork root block's ID for the present spork, which this node is
21+ // participating in. A Node's state is strictly tied to a specific spork, and should never change during
22+ // the lifetime of the node.
23+ // This values is inserted exactly once when bootstrapping the state and should always be present for a
24+ // properly bootstrapped node.
25+ // No errors are expected during normal operation.
2026func RetrieveSporkRootBlockID (r storage.Reader , blockID * flow.Identifier ) error {
2127 return RetrieveByKey (r , MakePrefix (codeSporkRootBlockID ), blockID )
2228}
0 commit comments