peer: don't pass closeCtx to chanCloser

This commit is contained in:
Johan T. Halseth 2018-05-21 15:04:23 +02:00
parent 0809880426
commit bb611e065d
No known key found for this signature in database
GPG Key ID: 15BAADA29DA20D26

28
peer.go

@ -1572,18 +1572,6 @@ func (p *peer) fetchActiveChanCloser(chanID lnwire.ChannelID) (*channelCloser, e
return nil, fmt.Errorf("cannot obtain best block")
}
// Before we create the chan closer, we'll start a new
// cooperative channel closure transaction from the chain arb.
// With this context, we'll ensure that we're able to respond
// if *any* of the transactions we sign off on are ever
// broadcast.
closeCtx, err := p.server.chainArb.BeginCoopChanClose(
*channel.ChannelPoint(),
)
if err != nil {
return nil, err
}
chanCloser = newChannelCloser(
chanCloseCfg{
channel: channel,
@ -1595,7 +1583,6 @@ func (p *peer) fetchActiveChanCloser(chanID lnwire.ChannelID) (*channelCloser, e
targetFeePerKw,
uint32(startingHeight),
nil,
closeCtx,
)
p.activeChanCloses[chanID] = chanCloser
}
@ -1638,20 +1625,6 @@ func (p *peer) handleLocalCloseReq(req *htlcswitch.ChanClose) {
return
}
// Before we create the chan closer, we'll start a new
// cooperative channel closure transaction from the chain arb.
// With this context, we'll ensure that we're able to respond
// if *any* of the transactions we sign off on are ever
// broadcast.
closeCtx, err := p.server.chainArb.BeginCoopChanClose(
*channel.ChannelPoint(),
)
if err != nil {
peerLog.Errorf(err.Error())
req.Err <- err
return
}
// Next, we'll create a new channel closer state machine to
// handle the close negotiation.
_, startingHeight, err := p.server.cc.chainIO.GetBestBlock()
@ -1671,7 +1644,6 @@ func (p *peer) handleLocalCloseReq(req *htlcswitch.ChanClose) {
req.TargetFeePerKw,
uint32(startingHeight),
req,
closeCtx,
)
p.activeChanCloses[chanID] = chanCloser