Broken payment validation
kincaidoneil opened this issue · comments
Since all of the methods within https://github.com/machinomy/machinomy/blob/master/packages/machinomy/src/PaymentValidation.ts are async and return promises, the conditions can't be applied to &&
directly. In effect, the isValid
method just returns the last boolean promise (isAboveMinSettlementPeriod), and never checks any of the other conditions.
This is the cause for #231, as when passing Machinomy a payment with a negative price, it would log the error that the payment was invalid/price was negative, but isValid
here
true
, saving the payment to the DB. Then when attempting to claim it, it cleared the entire channel, since the value is parsed as an unsigned integer.🤦♂️
Thank you @kincaidoneil!!
Fixed in #233