mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-28 14:40:51 +02:00
cmd/lncli: add unused flag to newAddr command
This commit is contained in:
committed by
Oliver Gugger
parent
03b4d88ed7
commit
4ea24c0820
@@ -132,6 +132,11 @@ var newAddressCommand = cli.Command{
|
|||||||
Usage: "(optional) the name of the account to " +
|
Usage: "(optional) the name of the account to " +
|
||||||
"generate a new address for",
|
"generate a new address for",
|
||||||
},
|
},
|
||||||
|
cli.BoolFlag{
|
||||||
|
Name: "unused",
|
||||||
|
Usage: "(optional) return the last unused address " +
|
||||||
|
"instead of generating a new one",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Description: `
|
Description: `
|
||||||
Generate a wallet new address. Address-types has to be one of:
|
Generate a wallet new address. Address-types has to be one of:
|
||||||
@@ -153,14 +158,25 @@ func newAddress(ctx *cli.Context) error {
|
|||||||
// Map the string encoded address type, to the concrete typed address
|
// Map the string encoded address type, to the concrete typed address
|
||||||
// type enum. An unrecognized address type will result in an error.
|
// type enum. An unrecognized address type will result in an error.
|
||||||
stringAddrType := ctx.Args().First()
|
stringAddrType := ctx.Args().First()
|
||||||
|
unused := ctx.Bool("unused")
|
||||||
|
|
||||||
var addrType lnrpc.AddressType
|
var addrType lnrpc.AddressType
|
||||||
switch stringAddrType { // TODO(roasbeef): make them ints on the cli?
|
switch stringAddrType { // TODO(roasbeef): make them ints on the cli?
|
||||||
case "p2wkh":
|
case "p2wkh":
|
||||||
addrType = lnrpc.AddressType_WITNESS_PUBKEY_HASH
|
addrType = lnrpc.AddressType_WITNESS_PUBKEY_HASH
|
||||||
|
if unused {
|
||||||
|
addrType = lnrpc.AddressType_UNUSED_WITNESS_PUBKEY_HASH
|
||||||
|
}
|
||||||
case "np2wkh":
|
case "np2wkh":
|
||||||
addrType = lnrpc.AddressType_NESTED_PUBKEY_HASH
|
addrType = lnrpc.AddressType_NESTED_PUBKEY_HASH
|
||||||
|
if unused {
|
||||||
|
addrType = lnrpc.AddressType_UNUSED_NESTED_PUBKEY_HASH
|
||||||
|
}
|
||||||
case "p2tr":
|
case "p2tr":
|
||||||
addrType = lnrpc.AddressType_TAPROOT_PUBKEY
|
addrType = lnrpc.AddressType_TAPROOT_PUBKEY
|
||||||
|
if unused {
|
||||||
|
addrType = lnrpc.AddressType_UNUSED_TAPROOT_PUBKEY
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("invalid address type %v, support address type "+
|
return fmt.Errorf("invalid address type %v, support address type "+
|
||||||
"are: p2wkh, np2wkh, and p2tr", stringAddrType)
|
"are: p2wkh, np2wkh, and p2tr", stringAddrType)
|
||||||
|
@@ -81,6 +81,9 @@ unlock or create.
|
|||||||
* [Restore support](https://github.com/lightningnetwork/lnd/pull/7678) for
|
* [Restore support](https://github.com/lightningnetwork/lnd/pull/7678) for
|
||||||
`PKCS8`-encoded cert private keys.
|
`PKCS8`-encoded cert private keys.
|
||||||
|
|
||||||
|
* Add [`--unused`](https://github.com/lightningnetwork/lnd/pull/6387) to
|
||||||
|
`lncli newaddr` command.
|
||||||
|
|
||||||
## Code Health
|
## Code Health
|
||||||
|
|
||||||
* Updated [our fork for serializing protobuf as JSON to be based on the
|
* Updated [our fork for serializing protobuf as JSON to be based on the
|
||||||
@@ -121,6 +124,7 @@ unlock or create.
|
|||||||
* Elle Mouton
|
* Elle Mouton
|
||||||
* Erik Arvstedt
|
* Erik Arvstedt
|
||||||
* ErikEk
|
* ErikEk
|
||||||
|
* gabbyprecious
|
||||||
* Guillermo Caracuel
|
* Guillermo Caracuel
|
||||||
* hieblmi
|
* hieblmi
|
||||||
* Jordi Montes
|
* Jordi Montes
|
||||||
|
Reference in New Issue
Block a user