link+contractcourt: rename processHodlEvent to processHtlcResolution

This commit is contained in:
carla 2019-12-20 12:25:07 +02:00
parent 6464f0dda0
commit ebfbc48973
No known key found for this signature in database
GPG Key ID: 4CA7FE54A6213C91
2 changed files with 10 additions and 9 deletions

@ -169,8 +169,8 @@ func (h *htlcIncomingContestResolver) Resolve() (ContractResolver, error) {
// Define closure to process htlc resolutions either direct or triggered by // Define closure to process htlc resolutions either direct or triggered by
// later notification. // later notification.
processHodlEvent := func(e invoices.HtlcResolution) (ContractResolver, processHtlcResolution := func(e invoices.HtlcResolution) (
error) { ContractResolver, error) {
if e.Preimage == nil { if e.Preimage == nil {
log.Infof("%T(%v): Exit hop HTLC canceled "+ log.Infof("%T(%v): Exit hop HTLC canceled "+
@ -212,7 +212,7 @@ func (h *htlcIncomingContestResolver) Resolve() (ContractResolver, error) {
// Resolve the htlc directly if possible. // Resolve the htlc directly if possible.
if event != nil { if event != nil {
return processHodlEvent(*event) return processHtlcResolution(*event)
} }
default: default:
return nil, err return nil, err
@ -254,7 +254,7 @@ func (h *htlcIncomingContestResolver) Resolve() (ContractResolver, error) {
case hodlItem := <-hodlChan: case hodlItem := <-hodlChan:
htlcResolution := hodlItem.(invoices.HtlcResolution) htlcResolution := hodlItem.(invoices.HtlcResolution)
return processHodlEvent(htlcResolution) return processHtlcResolution(htlcResolution)
case newBlock, ok := <-blockEpochs.Epochs: case newBlock, ok := <-blockEpochs.Epochs:
if !ok { if !ok {

@ -1164,7 +1164,7 @@ loop:
return fmt.Errorf("hodl htlc not found: %v", circuitKey) return fmt.Errorf("hodl htlc not found: %v", circuitKey)
} }
if err := l.processHodlEvent(htlcResolution, hodlHtlc); err != nil { if err := l.processHtlcResolution(htlcResolution, hodlHtlc); err != nil {
return err return err
} }
@ -1187,9 +1187,10 @@ loop:
return nil return nil
} }
// processHodlEvent applies a received htlc resolution to the provided htlc. // processHtlcResolution applies a received htlc resolution to the provided
// When this function returns without an error, the commit tx should be updated. // htlc. When this function returns without an error, the commit tx should be
func (l *channelLink) processHodlEvent(resolution invoices.HtlcResolution, // updated.
func (l *channelLink) processHtlcResolution(resolution invoices.HtlcResolution,
htlc hodlHtlc) error { htlc hodlHtlc) error {
circuitKey := resolution.CircuitKey circuitKey := resolution.CircuitKey
@ -2851,7 +2852,7 @@ func (l *channelLink) processExitHop(pd *lnwallet.PaymentDescriptor,
} }
// Process the received resolution. // Process the received resolution.
return l.processHodlEvent(*event, htlc) return l.processHtlcResolution(*event, htlc)
} }
// settleHTLC settles the HTLC on the channel. // settleHTLC settles the HTLC on the channel.