breez / breez-sdk-greenlight

MIT License
244 stars 43 forks source link

Use received amount to account for overpayment #1038

Closed dangeross closed 4 months ago

dangeross commented 4 months ago

Changes Payment mapping to use the received amount instead of invoice amount to account for overpayments.

Example when sending in Phoenix 1500 instead of 1000 msats:

Received payment: amount_received_msat: Some(Amount { msat: 1500 }) amount_msat: Some(Amount { msat: 1000 })

Fixes #1026

JssDWt commented 4 months ago

Looks good.

What about payments that were already inserted with the amount_msat amount? Should we update those somehow?

dangeross commented 4 months ago

What about payments that were already inserted with the amount_msat amount? Should we update those somehow?

@JssDWt I think if drop the last_backup_time cached_item in the migration, then we would re-sync all the payments (paid invoices) from Greenlight. What do you think @roeierez?

JssDWt commented 4 months ago

I think if drop the last_backup_time cached_item in the migration, then we would re-sync all the payments (paid invoices) from Greenlight

I think it's the last_sync_time we would have to drop there.

dangeross commented 4 months ago

I think it's the last_sync_time we would have to drop there.

Oops, yeah