From 2dd8f07014a4cb6b1e55ad2f5bcc0d1d80e5620e Mon Sep 17 00:00:00 2001 From: Conner Fromknecht Date: Mon, 13 Aug 2018 18:49:22 -0700 Subject: [PATCH] htlcswitch/switch: use non-strict PaymentControl --- htlcswitch/switch.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htlcswitch/switch.go b/htlcswitch/switch.go index d6e6a46a..c0cb310b 100644 --- a/htlcswitch/switch.go +++ b/htlcswitch/switch.go @@ -290,7 +290,7 @@ func New(cfg Config, currentHeight uint32) (*Switch, error) { cfg: &cfg, circuits: circuitMap, paymentSequencer: sequencer, - control: NewPaymentControl(cfg.DB), + control: NewPaymentControl(false, cfg.DB), linkIndex: make(map[lnwire.ChannelID]ChannelLink), mailOrchestrator: newMailOrchestrator(), forwardingIndex: make(map[lnwire.ShortChannelID]ChannelLink), @@ -852,7 +852,8 @@ func (s *Switch) handleLocalDispatch(pkt *htlcPacket) error { // Persistently mark that a payment to this payment hash // succeeded. This will prevent us from ever making another // payment to this hash. - if err := s.control.Success(pkt.circuit.PaymentHash); err != nil { + err := s.control.Success(pkt.circuit.PaymentHash) + if err != nil && err != ErrPaymentAlreadyCompleted { return err } @@ -864,7 +865,8 @@ func (s *Switch) handleLocalDispatch(pkt *htlcPacket) error { // Persistently mark that a payment to this payment hash failed. // This will permit us to make another attempt at a successful // payment. - if err := s.control.Fail(pkt.circuit.PaymentHash); err != nil { + err := s.control.Fail(pkt.circuit.PaymentHash) + if err != nil && err != ErrPaymentAlreadyCompleted { return err }