htlcswitch: switch ackDownStreamPackets order with contract update call

This commit modifies updateCommitTx to error with ErrLinkShuttingDown
when we try to send a ContractUpdate on the htlcUpdates chan and the
link has closed the quit chan. It also changes the order of the call
to ackDownStreamPackets and contract update call for consistency since
the packets should be acknowledged before the link goes down.
This commit is contained in:
nsa 2020-03-09 13:36:33 -04:00
parent f757bf48bd
commit 4fe174ba4e

@ -2060,6 +2060,10 @@ func (l *channelLink) updateCommitTx() error {
return err
}
if err := l.ackDownStreamPackets(); err != nil {
return err
}
// The remote party now has a new pending commitment, so we'll update
// the contract court to be aware of this new set (the prior old remote
// pending).
@ -2069,11 +2073,7 @@ func (l *channelLink) updateCommitTx() error {
Htlcs: pendingHTLCs,
}:
case <-l.quit:
return nil
}
if err := l.ackDownStreamPackets(); err != nil {
return err
return ErrLinkShuttingDown
}
commitSig := &lnwire.CommitSig{