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 committed 2023-02-08 12:35:44 +01:00
1 parent 3bb68661e7
commit cdb015223b
9 files changed
+625 -413

No files matched your search

+6 -2
View File
@@ -446,7 +446,10 @@ type WalletController interface {
// specified fee rate. If there is change left, a change output from the
// internal wallet is added and the index of the change output is
// returned. Otherwise no additional output is created and the index -1
// is returned.
// is returned. If no custom change scope is specified, the BIP0084 will
// be used for default accounts and single imported public keys. For
// custom account, no key scope should be provided as the coin selection
// key scope will always be used to generate the change address.
//
// NOTE: If the packet doesn't contain any inputs, coin selection is
// performed automatically. The account parameter must be non-empty as
@@ -458,7 +461,8 @@ type WalletController interface {
// the selected/validated inputs. It is in the caller's responsibility
// to lock the inputs before handing them out.
FundPsbt(packet *psbt.Packet, minConfs int32,
feeRate chainfee.SatPerKWeight, account string) (int32, error)
feeRate chainfee.SatPerKWeight, account string,
changeScope *waddrmgr.KeyScope) (int32, error)
// SignPsbt expects a partial transaction with all inputs and outputs
// fully declared and tries to sign all unsigned inputs that have all