From 795b5559f0f34df719beedf1ec2d20703571e2b1 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Mon, 8 Jan 2018 18:57:11 -0800 Subject: [PATCH] htlcswitch: print rhash in error messages of mockInvoiceRegistry --- htlcswitch/mock.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htlcswitch/mock.go b/htlcswitch/mock.go index 4444ec31..2524c47c 100644 --- a/htlcswitch/mock.go +++ b/htlcswitch/mock.go @@ -473,7 +473,7 @@ func (i *mockInvoiceRegistry) LookupInvoice(rHash chainhash.Hash) (channeldb.Inv invoice, ok := i.invoices[rHash] if !ok { - return channeldb.Invoice{}, errors.New("can't find mock invoice") + return channeldb.Invoice{}, fmt.Errorf("can't find mock invoice: %x", rHash[:]) } return invoice, nil @@ -485,7 +485,7 @@ func (i *mockInvoiceRegistry) SettleInvoice(rhash chainhash.Hash) error { invoice, ok := i.invoices[rhash] if !ok { - return errors.New("can't find mock invoice") + return fmt.Errorf("can't find mock invoice: %x", rhash[:]) } invoice.Terms.Settled = true @@ -500,6 +500,7 @@ func (i *mockInvoiceRegistry) AddInvoice(invoice channeldb.Invoice) error { rhash := fastsha256.Sum256(invoice.Terms.PaymentPreimage[:]) i.invoices[chainhash.Hash(rhash)] = invoice + return nil }