htlcswitch/switch: use non-strict PaymentControl

This commit is contained in:
Conner Fromknecht 2018-08-13 18:49:22 -07:00
parent 2027444a56
commit 2dd8f07014
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7

@ -290,7 +290,7 @@ func New(cfg Config, currentHeight uint32) (*Switch, error) {
cfg: &cfg, cfg: &cfg,
circuits: circuitMap, circuits: circuitMap,
paymentSequencer: sequencer, paymentSequencer: sequencer,
control: NewPaymentControl(cfg.DB), control: NewPaymentControl(false, cfg.DB),
linkIndex: make(map[lnwire.ChannelID]ChannelLink), linkIndex: make(map[lnwire.ChannelID]ChannelLink),
mailOrchestrator: newMailOrchestrator(), mailOrchestrator: newMailOrchestrator(),
forwardingIndex: make(map[lnwire.ShortChannelID]ChannelLink), 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 // Persistently mark that a payment to this payment hash
// succeeded. This will prevent us from ever making another // succeeded. This will prevent us from ever making another
// payment to this hash. // 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 return err
} }
@ -864,7 +865,8 @@ func (s *Switch) handleLocalDispatch(pkt *htlcPacket) error {
// Persistently mark that a payment to this payment hash failed. // Persistently mark that a payment to this payment hash failed.
// This will permit us to make another attempt at a successful // This will permit us to make another attempt at a successful
// payment. // 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 return err
} }