invoices/invoiceregistry: unbundle invalid preimage error

This commit is contained in:
Conner Fromknecht 2021-03-03 09:59:51 -08:00
parent 9da3e7fc90
commit 137258fb58
No known key found for this signature in database
GPG Key ID: E7D737B67FA592C7

@ -707,8 +707,12 @@ func (i *InvoiceRegistry) processKeySend(ctx invoiceUpdateCtx) error {
// Cancel htlc is preimage is invalid. // Cancel htlc is preimage is invalid.
preimage, err := lntypes.MakePreimage(preimageSlice) preimage, err := lntypes.MakePreimage(preimageSlice)
if err != nil || preimage.Hash() != ctx.hash { if err != nil {
return errors.New("invalid keysend preimage") return err
}
if preimage.Hash() != ctx.hash {
return fmt.Errorf("invalid keysend preimage %v for hash %v",
preimage, ctx.hash)
} }
// Only allow keysend for non-mpp payments. // Only allow keysend for non-mpp payments.