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:
parent
3e1c98f2f7
commit
0585ed93be
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user