-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Persist failed payment amount #589
Conversation
Think I need to consider how this will be remotely synced also |
If the amount is needed to be synced then it should be written to the sync db such as when we write to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just need to clarify the migration.
let mut payment = Payment { | ||
id: row.get(0)?, | ||
payment_type: PaymentType::from_str(payment_type_str.as_str()).unwrap(), | ||
payment_time: row.get(2)?, | ||
amount_msat, | ||
amount_msat: match status { | ||
PaymentStatus::Failed => failed_amount_msat.unwrap_or_default(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we have a migration issue for existing failed payments (even with non zero invoices) that currently will get zero value here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, it would be 0 for previously failed payments. To my knowledge its not possible to retreive failed payment amounts from GL. The alternative is to add failed_amount_msat: Option<u64>
to Payment directly. But it will still not have a value for a failed payment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not concerned about existing failed payments of zero invoices. We can't control these but I am worried about existing failed payments of invoices with amount. Shouldn't we fall back to the existing invoice amount to solve this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that's a good idea. But it is possible as a migration step? I'll look into it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A minor suggestion, otherwise looks good.
amount_msat: match status { | ||
PaymentStatus::Failed => failed_amount_msat.unwrap_or(amount_msat), | ||
_ => amount_msat, | ||
}, | ||
fee_msat: row.get(4)?, | ||
status: row.get(5)?, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
status: row.get(5)?, | |
status, |
47db0e7
to
d1289b4
Compare
Persists the last failed payment amount to the payment_external_info table.
Fixes #551