Skip to content

Commit

Permalink
Merge pull request #2397 from halseth/reject-commitment-expected-fee-…
Browse files Browse the repository at this point in the history
…reset-bug

[bugfix] Process fee updates as any other update message
  • Loading branch information
Roasbeef committed Jan 15, 2019
2 parents 815c4a9 + e6ee835 commit 9c59ac4
Show file tree
Hide file tree
Showing 4 changed files with 313 additions and 128 deletions.
14 changes: 12 additions & 2 deletions htlcswitch/link.go
Original file line number Diff line number Diff line change
Expand Up @@ -681,9 +681,14 @@ func (l *channelLink) resolveFwdPkg(fwdPkg *channeldb.FwdPkg) (bool, error) {
// If the package is fully acked but not completed, it must still have
// settles and fails to propagate.
if !fwdPkg.SettleFailFilter.IsFull() {
settleFails := lnwallet.PayDescsFromRemoteLogUpdates(
settleFails, err := lnwallet.PayDescsFromRemoteLogUpdates(
fwdPkg.Source, fwdPkg.Height, fwdPkg.SettleFails,
)
if err != nil {
l.errorf("Unable to process remote log updates: %v",
err)
return false, err
}
l.processRemoteSettleFails(fwdPkg, settleFails)
}

Expand All @@ -693,9 +698,14 @@ func (l *channelLink) resolveFwdPkg(fwdPkg *channeldb.FwdPkg) (bool, error) {
// batch of adds presented to the sphinx router does not ever change.
var needUpdate bool
if !fwdPkg.AckFilter.IsFull() {
adds := lnwallet.PayDescsFromRemoteLogUpdates(
adds, err := lnwallet.PayDescsFromRemoteLogUpdates(
fwdPkg.Source, fwdPkg.Height, fwdPkg.Adds,
)
if err != nil {
l.errorf("Unable to process remote log updates: %v",
err)
return false, err
}
needUpdate = l.processRemoteAdds(fwdPkg, adds)

// If the link failed during processing the adds, we must
Expand Down
7 changes: 6 additions & 1 deletion htlcswitch/switch.go
Original file line number Diff line number Diff line change
Expand Up @@ -1781,9 +1781,14 @@ func (s *Switch) loadChannelFwdPkgs(source lnwire.ShortChannelID) ([]*channeldb.
// NOTE: This should mimic the behavior processRemoteSettleFails.
func (s *Switch) reforwardSettleFails(fwdPkgs []*channeldb.FwdPkg) {
for _, fwdPkg := range fwdPkgs {
settleFails := lnwallet.PayDescsFromRemoteLogUpdates(
settleFails, err := lnwallet.PayDescsFromRemoteLogUpdates(
fwdPkg.Source, fwdPkg.Height, fwdPkg.SettleFails,
)
if err != nil {
log.Errorf("Unable to process remote log updates: %v",
err)
continue
}

switchPackets := make([]*htlcPacket, 0, len(settleFails))
for i, pd := range settleFails {
Expand Down
Loading

0 comments on commit 9c59ac4

Please sign in to comment.