server+peer: rename disableChannel->announceChanStatus

Now takes a boolean whether to disable/activate, and keeps track of the
last update sent to avoid sending duplicates.
This commit is contained in:
Johan T. Halseth
2018-08-09 10:03:14 +02:00
parent 887722f38f
commit b5bfdd72b5
2 changed files with 52 additions and 12 deletions

14
peer.go
View File

@@ -1690,8 +1690,11 @@ func (p *peer) fetchActiveChanCloser(chanID lnwire.ChannelID) (*channelCloser, e
channel: channel,
unregisterChannel: p.server.htlcSwitch.RemoveLink,
broadcastTx: p.server.cc.wallet.PublishTransaction,
disableChannel: p.server.disableChannel,
quit: p.quit,
disableChannel: func(op wire.OutPoint) error {
return p.server.announceChanStatus(op,
true)
},
quit: p.quit,
},
deliveryAddr,
feePerKw,
@@ -1750,8 +1753,11 @@ func (p *peer) handleLocalCloseReq(req *htlcswitch.ChanClose) {
channel: channel,
unregisterChannel: p.server.htlcSwitch.RemoveLink,
broadcastTx: p.server.cc.wallet.PublishTransaction,
disableChannel: p.server.disableChannel,
quit: p.quit,
disableChannel: func(op wire.OutPoint) error {
return p.server.announceChanStatus(op,
true)
},
quit: p.quit,
},
deliveryAddr,
req.TargetFeePerKw,