This commit is contained in:
0xfandom 2026-08-11 05:49:46 +05:30 committed by GitHub
commit cf7d9c26f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 80 additions and 1 deletions

View file

@ -692,6 +692,41 @@ func payInvoice(cliCtx *cli.Context) error {
)
}
// addInvoiceUnsupportedFlags is the set of flags that are inherited from
// lncli's addinvoice command but don't apply to Taproot Asset invoices. The
// addInvoice action below never reads these, so we strip them to avoid
// presenting options that have no effect.
var addInvoiceUnsupportedFlags = map[string]struct{}{
// The final-hop CLTV delta isn't applied to asset invoices.
"cltv_expiry_delta": {},
// Blinded paths aren't supported for asset invoices; the relevant hop
// hints are added as part of the RFQ process instead.
"blind": {},
"min_real_blinded_hops": {},
"num_blinded_hops": {},
"max_blinded_paths": {},
"blinded_path_omit_node": {},
"blinded_path_incoming_channel_list": {},
}
// withoutUnsupportedAddInvoiceFlags returns the given flags with the ones that
// don't apply to Taproot Asset invoices (see addInvoiceUnsupportedFlags)
// removed.
func withoutUnsupportedAddInvoiceFlags(flags []cli.Flag) []cli.Flag {
filtered := make([]cli.Flag, 0, len(flags))
for _, flag := range flags {
_, unsupported := addInvoiceUnsupportedFlags[flag.GetName()]
if unsupported {
continue
}
filtered = append(filtered, flag)
}
return filtered
}
var addInvoiceCommand = cli.Command{
Name: "addinvoice",
Category: commands.AddInvoiceCommand.Category,
@ -703,7 +738,9 @@ var addInvoiceCommand = cli.Command{
ArgsUsage: "[--asset_id=X | --group_key=X] --asset_amount=Y " +
"[--rfq_peer_pubkey=Z] ",
Flags: append(
commands.AddInvoiceCommand.Flags,
withoutUnsupportedAddInvoiceFlags(
commands.AddInvoiceCommand.Flags,
),
cli.StringFlag{
Name: "asset_id",
Usage: "the asset ID of the asset to receive; cannot " +

37
cmd/litcli/ln_test.go Normal file
View file

@ -0,0 +1,37 @@
package main
import (
"testing"
"github.com/stretchr/testify/require"
)
// TestAddInvoiceCommandFlags ensures that the litcli addinvoice command keeps
// the flags its action actually reads (including the asset-specific ones it
// adds) while dropping the inherited lncli flags that don't apply to Taproot
// Asset invoices.
func TestAddInvoiceCommandFlags(t *testing.T) {
t.Parallel()
flagNames := make(map[string]struct{})
for _, flag := range addInvoiceCommand.Flags {
flagNames[flag.GetName()] = struct{}{}
}
// Flags that the addInvoice action reads must remain available.
expected := []string{
"memo", "preimage", "amt", "amt_msat", "description_hash",
"fallback_addr", "expiry", "private", "amp",
"asset_id", "group_key", "asset_amount", "rfq_peer_pubkey",
}
for _, name := range expected {
_, ok := flagNames[name]
require.Truef(t, ok, "expected flag %q to be present", name)
}
// Flags that don't apply to asset invoices must be removed.
for name := range addInvoiceUnsupportedFlags {
_, ok := flagNames[name]
require.Falsef(t, ok, "expected flag %q to be removed", name)
}
}

View file

@ -41,6 +41,11 @@
permanently, requiring a manual restart. The wait is now bounded by a
configurable, generous timeout (`--lndreadytimeout`, defaulting to 10
minutes) instead of a fixed attempt count.
* [Hide unsupported flags from `litcli ln
addinvoice`](https://github.com/lightninglabs/lightning-terminal/pull/1335):
The `addinvoice` command no longer advertises the blinded-path flags or
`--cltv_expiry_delta`, which were inherited from `lncli` but have no effect on
Taproot Asset invoices.
### Functional Changes/Additions