From 87cc5571efcd40a8c8c211b8cb7d3071e096c0d7 Mon Sep 17 00:00:00 2001 From: Andras Banki-Horvath Date: Thu, 30 Apr 2020 15:54:48 +0200 Subject: [PATCH] general: add ExternalHtlc to SwapInfo and add comments --- interface.go | 19 +++++++++++++------ loopin.go | 1 + 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/interface.go b/interface.go index e7181784..6f1942c2 100644 --- a/interface.go +++ b/interface.go @@ -260,15 +260,22 @@ type SwapInfoKit struct { type SwapInfo struct { loopdb.SwapStateData - LastUpdate time.Time - - SwapHash lntypes.Hash - - SwapType swap.Type - loopdb.SwapContract + // LastUpdateTime is the time of the last state change. + LastUpdate time.Time + + // SwapHash stores the swap preimage hash. + SwapHash lntypes.Hash + + // SwapType describes whether this is a loop in or loop out swap. + SwapType swap.Type + + // HtlcAddress holds the HTLC address of the swap. HtlcAddress btcutil.Address + + // ExternalHtlc is set to true for external loop-in swaps. + ExternalHtlc bool } // LastUpdate returns the last update time of the swap diff --git a/loopin.go b/loopin.go index 510facc4..1cd26338 100644 --- a/loopin.go +++ b/loopin.go @@ -244,6 +244,7 @@ func (s *loopInSwap) sendUpdate(ctx context.Context) error { s.log.Infof("Loop in swap state: %v", info.State) info.HtlcAddress = s.htlc.Address + info.ExternalHtlc = s.ExternalHtlc select { case s.statusChan <- *info: