Skip to content

Commit

Permalink
rpcserver: DeleteAssetRoot takes account of universe proof type
Browse files Browse the repository at this point in the history
  • Loading branch information
ffranr committed Oct 9, 2023
1 parent fba52d3 commit 9bce95e
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions rpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -2739,6 +2739,26 @@ func (r *rpcServer) DeleteAssetRoot(ctx context.Context,

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

// If the universe proof type is unspecified, we'll delete both the
// issuance and transfer roots.
if universeID.ProofType == universe.ProofTypeUnspecified {
universeID.ProofType = universe.ProofTypeIssuance
_, err := r.cfg.BaseUniverse.DeleteRoot(ctx, universeID)
if err != nil {
return nil, err
}

universeID.ProofType = universe.ProofTypeTransfer
_, err = r.cfg.BaseUniverse.DeleteRoot(ctx, universeID)
if err != nil {
return nil, err
}

return &unirpc.DeleteRootResponse{}, nil
}

// At this point the universe proof type was specified, so we'll only
// delete the root for that proof type.
_, err = r.cfg.BaseUniverse.DeleteRoot(ctx, universeID)
if err != nil {
return nil, err
Expand Down

0 comments on commit 9bce95e

Please sign in to comment.