Skip to content

Commit 9c4ab52

Browse files
committed
supplyverifier: validate asset group before starting state machine
Verify that the asset group is supported before starting a supplyverifier state machine for it.
1 parent fe8d982 commit 9c4ab52

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

universe/supplyverifier/manager.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -307,11 +307,18 @@ func (m *Manager) fetchStateMachine(assetSpec asset.Specifier) (*StateMachine,
307307
ctx, cancel := m.WithCtxQuitNoTimeout()
308308
defer cancel()
309309

310-
// TODO(ffranr): Check that the asset group supports supply commitments
311-
// and that this node does not create supply commitments for the asset
312-
// group (i.e. it does not own the delegation key). We don't want to
313-
// run a verifier state machine for an asset group supply commitment
314-
// that we issue ourselves.
310+
// Check that the asset group supports supply commitments and that
311+
// this node does not create supply commitments for the asset group
312+
// (i.e. it does not own the delegation key). We don't want to run
313+
// a verifier state machine for an asset group supply commitment
314+
// that we issue ourselves.
315+
err = supplycommit.CheckSupplyCommitSupport(
316+
ctx, m.cfg.AssetLookup, assetSpec, false,
317+
)
318+
if err != nil {
319+
return nil, fmt.Errorf("asset group is not suitable for "+
320+
"supply verifier state machine: %w", err)
321+
}
315322

316323
newSm, err := m.startAssetSM(ctx, assetSpec)
317324
if err != nil {

0 commit comments

Comments
 (0)