You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We move from a flat model with a single `IncomingPayment` class and a combination of `Origin` + `ReceivedWith` parts to a hierarchical model.
This new model:
- makes incoming/outgoing databases symmetrical
- removes impossible combinations allowed in the previous model (e.g. an on-chain origin with a fee-credit part)
- removes hacks required for the handling of on-chain deposits, which were shoe-horned in what was originally a lightning-only model
Before:
```
Origin
|
`--- Invoice
|
`--- Offer
|
`--- SwapIn
|
`--- OnChain
ReceivedWith
|
`--- LightningPayment
|
`--- AddedToFeeCredit
|
`--- OnChainIncomingPayment
|
`--- NewChannel
|
`--- SpliceIn
```
After:
```
IncomingPayment
|
`--- LightningIncomingPayment
| |
| `--- Bolt11IncomingPayment
| |
| `--- Bolt12IncomingPayment
|
`--- OnChainIncomingPayment
|
`--- NewChannelIncomingPayment
|
`--- SpliceInIncomingPayment
|
`--- LegacySwapInIncomingPayment
|
`--- LegacyPayToOpenIncomingPayment
LightningIncomingPayment.Part
|
`--- Htlc
|
`--- FeeCredit
```
The handling of backward compatible data is tricky, especially for legacy pay-to-open/pay-to-splice, which can be a mix of lightning parts and on-chain parts, and either Bolt11 or Bolt12. Note that `Legacy*` classes are not used at all within `lightning-kmp`, they are just meant to handle pre-existing data in the database.
payment | old model | new model
-------------------------------|-----------------------------------------------|------------------------
Plain Lightning Bolt11 | Origin=Invoice, ReceivedWith=LightningPayment | Bolt11IncomingPayment
Plain Lightning Bolt12 | Origin=Offer, ReceivedWith=LightningPayment | Bolt12IncomingPayment
Pre-otf pay-to-open Bolt11 | Origin=Invoice, ReceivedWith=NewChannel | LegacyPayToOpenIncomingPayment
Pre-otf pay-to-splice Bolt11 | Origin=Invoice, ReceivedWith=SpliceIn | LegacyPayToOpenIncomingPayment
Pre-otf pay-to-open Bolt12 | Origin=Offer, ReceivedWith=NewChannel | LegacyPayToOpenIncomingPayment
Pre-otf pay-to-splice Bolt12 | Origin=Offer, ReceivedWith=SpliceIn | LegacyPayToOpenIncomingPayment
Legacy trusted swap-in | Origin=SwapIn, ReceivedWith=NewChannel | LegacySwapInIncomingPayment
Swap-in potentiam open | Origin=OnChain, ReceivedWith=NewChannel | NewChannelIncomingPayment
Swap-in potentiam splice | Origin=OnChain, ReceivedWith=SpliceIn | SpliceInIncomingPayment
0 commit comments