Skip to content

Commit

Permalink
cmd/lncli: add 'wallet psbt fundtemplate' command
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
guggero committed Feb 26, 2024
1 parent 54fa580 commit f333581
Show file tree
Hide file tree
Showing 2 changed files with 378 additions and 3 deletions.
25 changes: 25 additions & 0 deletions cmd/lncli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"syscall"

"github.com/btcsuite/btcd/btcutil"
"github.com/btcsuite/btcd/chaincfg"
"github.com/lightningnetwork/lnd"
"github.com/lightningnetwork/lnd/build"
"github.com/lightningnetwork/lnd/lncfg"
Expand Down Expand Up @@ -537,3 +538,27 @@ func readPassword(text string) ([]byte, error) {
fmt.Println()
return pw, err
}

// networkParams parses the global network flag into a chaincfg.Params.
func networkParams(ctx *cli.Context) (*chaincfg.Params, error) {
network := strings.ToLower(ctx.GlobalString("network"))
switch network {
case "mainnet":
return &chaincfg.MainNetParams, nil

case "testnet":
return &chaincfg.TestNet3Params, nil

case "regtest":
return &chaincfg.RegressionNetParams, nil

case "simnet":
return &chaincfg.SimNetParams, nil

case "signet":
return &chaincfg.SigNetParams, nil

default:
return nil, fmt.Errorf("unknown network: %v", network)
}
}
Loading

0 comments on commit f333581

Please sign in to comment.