walletrpc+lnwallet: possibility to define an address type for changes in FundPsbt

By default, P2TR addresses are used for changes. However, some users
might encounter some problems with this change. We add the possibility
to define a custom address type in FundPsbt for default/imported accounts
(only P2TR for now). If no address type is specified for these accounts,
we will use P2WKH by default.
This commit is contained in:
Torakushi
2023-02-02 13:40:02 +01:00
parent 3bb68661e7
commit cdb015223b
9 changed files with 625 additions and 413 deletions

View File

@@ -995,6 +995,23 @@ message LabelTransactionRequest {
message LabelTransactionResponse {
}
// The possible change address types for default accounts and single imported
// public keys. By default, P2WPKH will be used. We don't provide the
// possibility to choose P2PKH as it is a legacy key scope, nor NP2WPKH as
// no key scope permits to do so. For custom accounts, no change type should
// be provided as the coin selection key scope will always be used to generate
// the change address.
enum ChangeAddressType {
// CHANGE_ADDRESS_TYPE_UNSPECIFIED indicates that no change address type is
// provided. We will then use P2WPKH address type for change (BIP0084 key
// scope).
CHANGE_ADDRESS_TYPE_UNSPECIFIED = 0;
// CHANGE_ADDRESS_TYPE_P2TR indicates to use P2TR address for change output
// (BIP0086 key scope).
CHANGE_ADDRESS_TYPE_P2TR = 1;
}
message FundPsbtRequest {
oneof template {
/*
@@ -1040,6 +1057,12 @@ message FundPsbtRequest {
// Whether unconfirmed outputs should be used as inputs for the transaction.
bool spend_unconfirmed = 7;
// The address type for the change. If empty, P2WPKH addresses will be used
// for default accounts and single imported public keys. For custom
// accounts, no change type should be provided as the coin selection key
// scope will always be used to generate the change address.
ChangeAddressType change_type = 8;
}
message FundPsbtResponse {
/*