routing: return full htlc attempt from shard handler

This commit is contained in:
Joost Jager committed 2020-05-12 19:56:50 +02:00
1 parent 8e7c0757ec
commit cc37485432
6 files changed
+76 -41

No files matched your search

+13
View File
@@ -2,6 +2,7 @@ package channeldb
import (
"bytes"
"errors"
"io"
"time"
@@ -177,6 +178,18 @@ func (m *MPPayment) InFlightHTLCs() []HTLCAttempt {
return inflights
}
// GetAttempt returns the specified htlc attempt on the payment.
func (m *MPPayment) GetAttempt(id uint64) (*HTLCAttempt, error) {
for _, htlc := range m.HTLCs {
htlc := htlc
if htlc.AttemptID == id {
return &htlc, nil
}
}
return nil, errors.New("htlc attempt not found on payment")
}
// serializeHTLCSettleInfo serializes the details of a settled htlc.
func serializeHTLCSettleInfo(w io.Writer, s *HTLCSettleInfo) error {
if _, err := w.Write(s.Preimage[:]); err != nil {