lnwallet: use in-memory height within channel's closeObserver

This commit partially rectifies a quick hack that was previously thrown
in to address an issue discovered due to possible state inconsistencies
between an active channel object and the daemon’s breachAbrbiter.

A prior commit has modified the interaction between the peer and the
breachArbiter to eliminate the state in consistency. Therefore, we no
longer need to access the database to ensure that we’re observing the
latest channel state in order to correctly make a decision about
whether a broadcast commitment transaction is a breach or not.
This commit is contained in:
Olaoluwa Osuntokun 2016-12-27 15:59:04 -08:00
parent 3e1c98f2f7
commit 0585ed93be
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

@ -703,7 +703,6 @@ func (lc *LightningChannel) closeObserver(channelCloseNtfn *chainntnfs.SpendEven
lc.Lock()
defer lc.Unlock()
// TODO(roasbeef): logs duplicated due to breachArbiter...
walletLog.Warnf("Unprompted commitment broadcast for ChannelPoint(%v) "+
"detected!", lc.channelState.ChanID)
@ -716,11 +715,7 @@ func (lc *LightningChannel) closeObserver(channelCloseNtfn *chainntnfs.SpendEven
obsfucator := lc.channelState.StateHintObsfucator
broadcastStateNum := uint64(GetStateNumHint(commitTxBroadcast, obsfucator))
currentStateNum, err := lc.channelState.CommitmentHeight()
if err != nil {
walletLog.Errorf("unable to obtain commitment height: %v", err)
return
}
currentStateNum := lc.currentHeight
switch {
// If state number spending transaction matches the current latest