Skip to content

Commit

Permalink
cmd: add new flags to importpubkey command
Browse files Browse the repository at this point in the history
A rescan flag and birthday block height flag was
added to the importpubkey command.

Signed-off-by: Ononiwu Maureen <59079323+Chinwendu20@users.noreply.github.com>
  • Loading branch information
Chinwendu20 authored and kaloudis committed Dec 18, 2024
1 parent a8d5f64 commit 0622f29
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions cmd/commands/walletrpc_active.go
Original file line number Diff line number Diff line change
Expand Up @@ -2184,6 +2184,16 @@ var importPubKeyCommand = cli.Command{
they happen after the import. Rescans to detect past events will be
supported later on.
`,
Flags: []cli.Flag{
cli.BoolFlag{
Name: "rescan",
Usage: "(optional) perform rescan",
},
cli.IntFlag{
Name: "height",
Usage: "The start height to use when fetching ",
},
},
Action: actionDecorator(importPubKey),
}

Expand All @@ -2192,7 +2202,7 @@ func importPubKey(ctx *cli.Context) error {

// Display the command's help message if we do not have the expected
// number of arguments/flags.
if ctx.NArg() != 2 || ctx.NumFlags() > 0 {
if ctx.NArg() != 2 {
return cli.ShowCommandHelp(ctx, "import-pubkey")
}

Expand All @@ -2209,8 +2219,10 @@ func importPubKey(ctx *cli.Context) error {
defer cleanUp()

req := &walletrpc.ImportPublicKeyRequest{
PublicKey: pubKeyBytes,
AddressType: addrType,
PublicKey: pubKeyBytes,
AddressType: addrType,
Rescan: ctx.Bool("rescan"),
BirthdayHeight: int32(ctx.Int("height")),
}
resp, err := walletClient.ImportPublicKey(ctxc, req)
if err != nil {
Expand Down

0 comments on commit 0622f29

Please sign in to comment.