Skip to content

Commit d2ee0a9

Browse files
committed
tapdb: improve code robustness by enforcing comment with error
Ignore and burn trees currently only support asset groups.
1 parent 23c4d4d commit d2ee0a9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tapdb/universe.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,17 @@ type BaseUniverseStore interface {
117117
// for a specific proof type.
118118
//
119119
// NOTE: This makes an assumption that only specifiers with a group key are
120-
// valid.
120+
// valid for the ignore and burn proof types.
121121
func specifierToIdentifier(spec asset.Specifier,
122122
proofType universe.ProofType) (universe.Identifier, error) {
123123

124124
var id universe.Identifier
125125

126126
// The specifier must have a group key to be able to be used within the
127127
// ignore or burn tree context.
128-
if !spec.HasGroupPubKey() {
128+
requireGroupKey := proofType == universe.ProofTypeIgnore ||
129+
proofType == universe.ProofTypeBurn
130+
if requireGroupKey && !spec.HasGroupPubKey() {
129131
return id, fmt.Errorf("group key must be set for proof type %v",
130132
proofType)
131133
}

0 commit comments

Comments
 (0)