funding: don't case to a net.TCPAddr to support tor stream isolation
In this commit, we fix an existing bug in the funding manager, that can be triggered if the user is connecting to a node over Tor, and then attempts to open a channel. An existing fix was added for the case that the receiving node established the channel, but this now makes that case symmetric.
This commit is contained in:
parent
51a3cab39c
commit
e184bbcb54
@ -4,7 +4,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
@ -881,10 +880,12 @@ func (f *fundingManager) handleFundingOpen(fmsg *fundingOpenMsg) {
|
|||||||
// TODO(roasbeef): assuming this was an inbound connection, replace
|
// TODO(roasbeef): assuming this was an inbound connection, replace
|
||||||
// port with default advertised port
|
// port with default advertised port
|
||||||
chainHash := chainhash.Hash(msg.ChainHash)
|
chainHash := chainhash.Hash(msg.ChainHash)
|
||||||
reservation, err := f.cfg.Wallet.InitChannelReservation(amt, 0,
|
reservation, err := f.cfg.Wallet.InitChannelReservation(
|
||||||
msg.PushAmount, lnwallet.SatPerKWeight(msg.FeePerKiloWeight), 0,
|
amt, 0, msg.PushAmount,
|
||||||
|
lnwallet.SatPerKWeight(msg.FeePerKiloWeight), 0,
|
||||||
fmsg.peerAddress.IdentityKey, fmsg.peerAddress.Address,
|
fmsg.peerAddress.IdentityKey, fmsg.peerAddress.Address,
|
||||||
&chainHash, msg.ChannelFlags)
|
&chainHash, msg.ChannelFlags,
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fndgLog.Errorf("Unable to initialize reservation: %v", err)
|
fndgLog.Errorf("Unable to initialize reservation: %v", err)
|
||||||
f.failFundingFlow(fmsg.peerAddress.IdentityKey,
|
f.failFundingFlow(fmsg.peerAddress.IdentityKey,
|
||||||
@ -2407,10 +2408,11 @@ func (f *fundingManager) handleInitFundingMsg(msg *initFundingMsg) {
|
|||||||
// Initialize a funding reservation with the local wallet. If the
|
// Initialize a funding reservation with the local wallet. If the
|
||||||
// wallet doesn't have enough funds to commit to this channel, then the
|
// wallet doesn't have enough funds to commit to this channel, then the
|
||||||
// request will fail, and be aborted.
|
// request will fail, and be aborted.
|
||||||
reservation, err := f.cfg.Wallet.InitChannelReservation(capacity,
|
reservation, err := f.cfg.Wallet.InitChannelReservation(
|
||||||
localAmt, msg.pushAmt, commitFeePerKw, msg.fundingFeePerVSize,
|
capacity, localAmt, msg.pushAmt, commitFeePerKw,
|
||||||
peerKey, msg.peerAddress.Address.(*net.TCPAddr),
|
msg.fundingFeePerVSize, peerKey, msg.peerAddress.Address,
|
||||||
&msg.chainHash, channelFlags)
|
&msg.chainHash, channelFlags,
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
msg.err <- err
|
msg.err <- err
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user