Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tapcli: fix flag checking for universe proof cmds #397

Merged
merged 1 commit into from
Jul 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions cmd/tapcli/universe.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,17 @@ var universeProofQueryCommand = cli.Command{
Usage: "query for a universe proof",
Description: `
Attempt to query the target universe for a given proof based on a top
level asset id or group key, and the leaf key of: outpoint || script
key.
level asset id or group key, and the leaf key of: outpoint || script key.
`,
Flags: universeProofArgs,
Action: universeProofQuery,
}

func parseAssetKey(ctx *cli.Context) (*universerpc.AssetKey, error) {
if !ctx.IsSet(outpointName) || !ctx.IsSet(scriptKeyName) {
return nil, fmt.Errorf("outpoint and script key must be set")
}

outpoint, err := tap.UnmarshalOutpoint(ctx.String(outpointName))
if err != nil {
return nil, err
Expand All @@ -341,15 +344,15 @@ func universeProofQuery(ctx *cli.Context) error {
client, cleanUp := getUniverseClient(ctx)
defer cleanUp()

universeID, err := parseUniverseID(ctx, true)
assetKey, err := parseAssetKey(ctx)
if err != nil {
return err
}
assetKey, err := parseAssetKey(ctx)

universeID, err := parseUniverseID(ctx, true)
if err != nil {
return err
}

uProof, err := client.QueryProof(ctxc, &universerpc.UniverseKey{
Id: universeID,
LeafKey: assetKey,
Expand Down Expand Up @@ -382,15 +385,15 @@ func universeProofInsert(ctx *cli.Context) error {
return cli.ShowSubcommandHelp(ctx)
}

universeID, err := parseUniverseID(ctx, true)
assetKey, err := parseAssetKey(ctx)
if err != nil {
return err
}
assetKey, err := parseAssetKey(ctx)

universeID, err := parseUniverseID(ctx, true)
if err != nil {
return err
}

filePath := lncfg.CleanAndExpandPath(ctx.String(proofPathName))
rawFile, err := readFile(filePath)
if err != nil {
Expand Down
Loading