lnd: modify the daemon's initialization to use new wallet API's
This commit is contained in:
parent
abf658a719
commit
0d871dabb3
@ -469,7 +469,6 @@ func (f *fundingManager) handleFundingComplete(fmsg *fundingCompleteMsg) {
|
||||
// Append a sighash type of SigHashAll to the signature as it's the
|
||||
// sighash type used implicitly within this type of channel for
|
||||
// commitment transactions.
|
||||
commitSig = append(commitSig, byte(txscript.SigHashAll))
|
||||
revokeKey := fmsg.msg.RevocationKey
|
||||
if err := resCtx.reservation.CompleteReservationSingle(revokeKey, fundingOut, commitSig); err != nil {
|
||||
// TODO(roasbeef): better error logging: peerID, channelID, etc.
|
||||
@ -521,7 +520,7 @@ func (f *fundingManager) handleFundingSignComplete(fmsg *fundingSignCompleteMsg)
|
||||
// The remote peer has responded with a signature for our commitment
|
||||
// transaction. We'll verify the signature for validity, then commit
|
||||
// the state to disk as we can now open the channel.
|
||||
commitSig := append(fmsg.msg.CommitSignature.Serialize(), byte(txscript.SigHashAll))
|
||||
commitSig := fmsg.msg.CommitSignature.Serialize()
|
||||
if err := resCtx.reservation.CompleteReservation(nil, commitSig); err != nil {
|
||||
fndgLog.Errorf("unable to complete reservation sign complete: %v", err)
|
||||
fmsg.peer.Disconnect()
|
||||
|
22
lnd.go
22
lnd.go
@ -18,6 +18,7 @@ import (
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/lnrpc"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/lightningnetwork/lnd/lnwallet/btcwallet"
|
||||
"github.com/roasbeef/btcrpcclient"
|
||||
)
|
||||
|
||||
@ -116,9 +117,8 @@ func lndMain() error {
|
||||
return err
|
||||
}
|
||||
|
||||
// Create, and start the lnwallet, which handles the core payment
|
||||
// channel logic, and exposes control via proxy state machines.
|
||||
walletConfig := &lnwallet.Config{
|
||||
// TODO(roasbeef): paarse config here select chosen WalletController
|
||||
walletConfig := &btcwallet.Config{
|
||||
PrivatePass: []byte("hello"),
|
||||
DataDir: filepath.Join(loadedConfig.DataDir, "lnwallet"),
|
||||
RpcHost: fmt.Sprintf("%v:%v", rpcIP[0], activeNetParams.rpcPort),
|
||||
@ -127,7 +127,18 @@ func lndMain() error {
|
||||
CACert: rpcCert,
|
||||
NetParams: activeNetParams.Params,
|
||||
}
|
||||
wallet, err := lnwallet.NewLightningWallet(walletConfig, chanDB, notifier)
|
||||
wc, err := btcwallet.New(walletConfig)
|
||||
if err != nil {
|
||||
fmt.Printf("unable to create wallet controller: %v\n", err)
|
||||
return err
|
||||
}
|
||||
signer := wc
|
||||
bio := wc
|
||||
|
||||
// Create, and start the lnwallet, which handles the core payment
|
||||
// channel logic, and exposes control via proxy state machines.
|
||||
wallet, err := lnwallet.NewLightningWallet(chanDB, notifier,
|
||||
wc, signer, bio, activeNetParams.Params)
|
||||
if err != nil {
|
||||
fmt.Printf("unable to create wallet: %v\n", err)
|
||||
return err
|
||||
@ -138,9 +149,6 @@ func lndMain() error {
|
||||
}
|
||||
ltndLog.Info("LightningWallet opened")
|
||||
|
||||
ec := &lnwallet.WaddrmgrEncryptorDecryptor{wallet.Manager}
|
||||
chanDB.RegisterCryptoSystem(ec)
|
||||
|
||||
// Set up the core server which will listen for incoming peer
|
||||
// connections.
|
||||
defaultListenAddrs := []string{
|
||||
|
4
peer.go
4
peer.go
@ -218,8 +218,8 @@ func newPeer(conn net.Conn, server *server, btcNet wire.BitcoinNet, inbound bool
|
||||
func (p *peer) loadActiveChannels(chans []*channeldb.OpenChannel) error {
|
||||
for _, dbChan := range chans {
|
||||
chanID := dbChan.ChanID
|
||||
lnChan, err := lnwallet.NewLightningChannel(p.server.lnwallet,
|
||||
p.server.chainNotifier, p.server.chanDB, dbChan)
|
||||
lnChan, err := lnwallet.NewLightningChannel(p.server.lnwallet.Signer,
|
||||
p.server.lnwallet, p.server.chainNotifier, dbChan)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user