contractcourt: only send resolution messages if we have any to send

This commit is contained in:
Olaoluwa Osuntokun 2019-05-16 17:38:44 -07:00
parent 877b8c55d3
commit 8a34b1ae88
No known key found for this signature in database
GPG Key ID: CE58F7F8E20FD9A2

View File

@ -895,11 +895,14 @@ func (c *ChannelArbitrator) stateStep(
// With the commitment broadcast, we'll then send over all
// messages we can send immediately.
err = c.cfg.DeliverResolutionMsg(pktsToSend...)
if err != nil {
// TODO(roasbeef): make sure packet sends are idempotent
log.Errorf("unable to send pkts: %v", err)
return StateError, closeTx, err
if len(pktsToSend) != 0 {
err := c.cfg.DeliverResolutionMsg(pktsToSend...)
if err != nil {
// TODO(roasbeef): make sure packet sends are
// idempotent
log.Errorf("unable to send pkts: %v", err)
return StateError, closeTx, err
}
}
log.Debugf("ChannelArbitrator(%v): inserting %v contract "+