Skip to content

Commit 69ce70d

Browse files
committed
rpcserver: DeleteAssetRoot takes account of universe proof type
1 parent 841fc5e commit 69ce70d

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

rpcserver.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2872,6 +2872,26 @@ func (r *rpcServer) DeleteAssetRoot(ctx context.Context,
28722872

28732873
rpcsLog.Debugf("Deleting asset root for %v", spew.Sdump(universeID))
28742874

2875+
// If the universe proof type is unspecified, we'll delete both the
2876+
// issuance and transfer roots.
2877+
if universeID.ProofType == universe.ProofTypeUnspecified {
2878+
universeID.ProofType = universe.ProofTypeIssuance
2879+
_, err := r.cfg.BaseUniverse.DeleteRoot(ctx, universeID)
2880+
if err != nil {
2881+
return nil, err
2882+
}
2883+
2884+
universeID.ProofType = universe.ProofTypeTransfer
2885+
_, err = r.cfg.BaseUniverse.DeleteRoot(ctx, universeID)
2886+
if err != nil {
2887+
return nil, err
2888+
}
2889+
2890+
return &unirpc.DeleteRootResponse{}, nil
2891+
}
2892+
2893+
// At this point the universe proof type was specified, so we'll only
2894+
// delete the root for that proof type.
28752895
_, err = r.cfg.BaseUniverse.DeleteRoot(ctx, universeID)
28762896
if err != nil {
28772897
return nil, err

0 commit comments

Comments
 (0)