Skip to content

Commit f333581

Browse files
committed
cmd/lncli: add 'wallet psbt fundtemplate' command
This commit adds a new sub command to the wallet that allows using the new funding option from a template. Creating a new command is way easier for the user to understand than adding multiple flags that are only valid in certain combinations.
1 parent 54fa580 commit f333581

File tree

2 files changed

+378
-3
lines changed

2 files changed

+378
-3
lines changed

cmd/lncli/main.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"syscall"
1616

1717
"github.com/btcsuite/btcd/btcutil"
18+
"github.com/btcsuite/btcd/chaincfg"
1819
"github.com/lightningnetwork/lnd"
1920
"github.com/lightningnetwork/lnd/build"
2021
"github.com/lightningnetwork/lnd/lncfg"
@@ -537,3 +538,27 @@ func readPassword(text string) ([]byte, error) {
537538
fmt.Println()
538539
return pw, err
539540
}
541+
542+
// networkParams parses the global network flag into a chaincfg.Params.
543+
func networkParams(ctx *cli.Context) (*chaincfg.Params, error) {
544+
network := strings.ToLower(ctx.GlobalString("network"))
545+
switch network {
546+
case "mainnet":
547+
return &chaincfg.MainNetParams, nil
548+
549+
case "testnet":
550+
return &chaincfg.TestNet3Params, nil
551+
552+
case "regtest":
553+
return &chaincfg.RegressionNetParams, nil
554+
555+
case "simnet":
556+
return &chaincfg.SimNetParams, nil
557+
558+
case "signet":
559+
return &chaincfg.SigNetParams, nil
560+
561+
default:
562+
return nil, fmt.Errorf("unknown network: %v", network)
563+
}
564+
}

0 commit comments

Comments
 (0)