Skip to content

Commit 95356ec

Browse files
committed
universe: improve logging, fix formatting and comments
1 parent 420f246 commit 95356ec

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

universe/base.go

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,13 @@ func (a *Archive) verifyIssuanceProof(ctx context.Context, id Identifier,
349349
a.cfg.MerkleVerifier, a.cfg.GroupVerifier, lookup,
350350
)
351351
if err != nil {
352-
return nil, fmt.Errorf("unable to verify proof: %w", err)
352+
var skBytes []byte
353+
if key.ScriptKey != nil {
354+
skBytes = key.ScriptKey.PubKey.SerializeCompressed()
355+
}
356+
return nil, fmt.Errorf("unable to verify proof (%v, "+
357+
"outpoint=%v, scriptKey=%x): %w", id.StringForLog(),
358+
key.OutPoint.String(), skBytes, err)
353359
}
354360

355361
newAsset := assetSnapshot.Asset
@@ -403,10 +409,10 @@ func (a *Archive) UpsertProofLeafBatch(ctx context.Context,
403409
log.Infof("Verifying %d new proofs for insertion into Universe",
404410
len(items))
405411

406-
// Issuances that also create an asset group, group anchors, must be
407-
// verified and stored before any issuances that may be reissuances into
408-
// the same asset group. This is required for proper verification of
409-
// reissuances, which may be in this batch.
412+
// Issuance proofs that also create an asset group (a.k.a. group
413+
// anchors) must be verified and stored before any issuance proofs that
414+
// may be re-issuances into the same asset group. This is required for
415+
// proper verification of re-issuances, which may be in this batch.
410416
var anchorItems []*Item
411417
nonAnchorItems := make([]*Item, 0, len(items))
412418
assetProofs := make(map[LeafKey]*proof.Proof)
@@ -476,7 +482,8 @@ func (a *Archive) UpsertProofLeafBatch(ctx context.Context,
476482
}
477483

478484
assetSnapshot, err := a.verifyIssuanceProof(
479-
ctx, i.ID, i.Key, assetProof, prevAssets,
485+
ctx, i.ID, i.Key, assetProof,
486+
prevAssets,
480487
)
481488
if err != nil {
482489
return err
@@ -488,8 +495,8 @@ func (a *Archive) UpsertProofLeafBatch(ctx context.Context,
488495
},
489496
)
490497
if err != nil {
491-
return fmt.Errorf("unable to verify issuance proofs: "+
492-
"%w", err)
498+
return fmt.Errorf("unable to batch verify issuance "+
499+
"proofs: %w", err)
493500
}
494501

495502
return nil

0 commit comments

Comments
 (0)