From b188d7f8034687c0a7ca7b08ac7783c299e77ffa Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Wed, 15 Jul 2026 09:19:36 +0900 Subject: [PATCH] wallet: fix nutzap setup, --mint was read under the wrong name and never used, the mandatory pubkey tag was never set on the kind:10019, and --force didn't actually replace the private key. --- wallet.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/wallet.go b/wallet.go index 97df609..e14091b 100644 --- a/wallet.go +++ b/wallet.go @@ -499,8 +499,13 @@ var wallet = &cli.Command{ } else { return fmt.Errorf("missing --private-key") } - } else if sk := c.String("private-key"); sk != "" && !c.Bool("force") { - return fmt.Errorf("refusing to replace existing private key, use the --force flag") + } else if sk := c.String("private-key"); sk != "" { + if !c.Bool("force") { + return fmt.Errorf("refusing to replace existing private key, use the --force flag") + } + if err := w.SetPrivateKey(ctx, sk); err != nil { + return err + } } kr, _, _ := gatherKeyerFromArguments(ctx, c) @@ -517,13 +522,18 @@ var wallet = &cli.Command{ info.ParseEvent(ie.Event) } - if mints := c.StringSlice("mints"); len(mints) == 0 && len(info.Mints) == 0 { + if mints := c.StringSlice("mint"); len(mints) > 0 { + info.Mints = mints + } else if len(info.Mints) == 0 { info.Mints = w.Mints } if len(info.Mints) == 0 { return fmt.Errorf("missing --mint") } + // the pubkey tag is mandatory, without it no one can send us nutzaps + info.PublicKey = nostr.PubKey(w.PublicKey.SerializeCompressed()[1:]) + evt := nostr.Event{} if err := info.ToEvent(ctx, kr, &evt); err != nil { return err