mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-01-18 21:35:24 +01:00
config_builder+rpcwallet: add full net params
As a preparation for parsing addresses, we need the full network parameters and not just the coin type in the RPC wallet.
This commit is contained in:
parent
efa36ce8f2
commit
5bf9b710fc
@ -691,7 +691,7 @@ func (d *RPCSignerWalletImpl) BuildChainControl(
|
|||||||
|
|
||||||
rpcKeyRing, err := rpcwallet.NewRPCKeyRing(
|
rpcKeyRing, err := rpcwallet.NewRPCKeyRing(
|
||||||
baseKeyRing, walletController,
|
baseKeyRing, walletController,
|
||||||
d.DefaultWalletImpl.cfg.RemoteSigner, walletConfig.CoinType,
|
d.DefaultWalletImpl.cfg.RemoteSigner, walletConfig.NetParams,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err := fmt.Errorf("unable to create RPC remote signing wallet "+
|
err := fmt.Errorf("unable to create RPC remote signing wallet "+
|
||||||
|
@ -14,6 +14,7 @@ import (
|
|||||||
"github.com/btcsuite/btcd/btcutil"
|
"github.com/btcsuite/btcd/btcutil"
|
||||||
"github.com/btcsuite/btcd/btcutil/hdkeychain"
|
"github.com/btcsuite/btcd/btcutil/hdkeychain"
|
||||||
"github.com/btcsuite/btcd/btcutil/psbt"
|
"github.com/btcsuite/btcd/btcutil/psbt"
|
||||||
|
"github.com/btcsuite/btcd/chaincfg"
|
||||||
"github.com/btcsuite/btcd/txscript"
|
"github.com/btcsuite/btcd/txscript"
|
||||||
"github.com/btcsuite/btcd/wire"
|
"github.com/btcsuite/btcd/wire"
|
||||||
basewallet "github.com/btcsuite/btcwallet/wallet"
|
basewallet "github.com/btcsuite/btcwallet/wallet"
|
||||||
@ -51,7 +52,7 @@ type RPCKeyRing struct {
|
|||||||
|
|
||||||
watchOnlyKeyRing keychain.SecretKeyRing
|
watchOnlyKeyRing keychain.SecretKeyRing
|
||||||
|
|
||||||
coinType uint32
|
netParams *chaincfg.Params
|
||||||
|
|
||||||
rpcTimeout time.Duration
|
rpcTimeout time.Duration
|
||||||
|
|
||||||
@ -69,7 +70,8 @@ var _ lnwallet.WalletController = (*RPCKeyRing)(nil)
|
|||||||
// delegates any signing or ECDH operations to the remove signer through RPC.
|
// delegates any signing or ECDH operations to the remove signer through RPC.
|
||||||
func NewRPCKeyRing(watchOnlyKeyRing keychain.SecretKeyRing,
|
func NewRPCKeyRing(watchOnlyKeyRing keychain.SecretKeyRing,
|
||||||
watchOnlyWalletController lnwallet.WalletController,
|
watchOnlyWalletController lnwallet.WalletController,
|
||||||
remoteSigner *lncfg.RemoteSigner, coinType uint32) (*RPCKeyRing, error) {
|
remoteSigner *lncfg.RemoteSigner,
|
||||||
|
netParams *chaincfg.Params) (*RPCKeyRing, error) {
|
||||||
|
|
||||||
rpcConn, err := connectRPC(
|
rpcConn, err := connectRPC(
|
||||||
remoteSigner.RPCHost, remoteSigner.TLSCertPath,
|
remoteSigner.RPCHost, remoteSigner.TLSCertPath,
|
||||||
@ -83,7 +85,7 @@ func NewRPCKeyRing(watchOnlyKeyRing keychain.SecretKeyRing,
|
|||||||
return &RPCKeyRing{
|
return &RPCKeyRing{
|
||||||
WalletController: watchOnlyWalletController,
|
WalletController: watchOnlyWalletController,
|
||||||
watchOnlyKeyRing: watchOnlyKeyRing,
|
watchOnlyKeyRing: watchOnlyKeyRing,
|
||||||
coinType: coinType,
|
netParams: netParams,
|
||||||
rpcTimeout: remoteSigner.Timeout,
|
rpcTimeout: remoteSigner.Timeout,
|
||||||
signerClient: signrpc.NewSignerClient(rpcConn),
|
signerClient: signrpc.NewSignerClient(rpcConn),
|
||||||
walletClient: walletrpc.NewWalletKitClient(rpcConn),
|
walletClient: walletrpc.NewWalletKitClient(rpcConn),
|
||||||
@ -610,7 +612,8 @@ func (r *RPCKeyRing) remoteSign(tx *wire.MsgTx, signDesc *input.SignDescriptor,
|
|||||||
Bip32Path: []uint32{
|
Bip32Path: []uint32{
|
||||||
keychain.BIP0043Purpose +
|
keychain.BIP0043Purpose +
|
||||||
hdkeychain.HardenedKeyStart,
|
hdkeychain.HardenedKeyStart,
|
||||||
r.coinType + hdkeychain.HardenedKeyStart,
|
r.netParams.HDCoinType +
|
||||||
|
hdkeychain.HardenedKeyStart,
|
||||||
uint32(signDesc.KeyDesc.Family) +
|
uint32(signDesc.KeyDesc.Family) +
|
||||||
hdkeychain.HardenedKeyStart,
|
hdkeychain.HardenedKeyStart,
|
||||||
0,
|
0,
|
||||||
|
Loading…
Reference in New Issue
Block a user