-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rework liquidity-ads purchase database storage
Payment details are now stored inside the purchase blob. The payment details type in the db table is just for information purpose and is not typed. It is a free text column. The column storing the purchase/lease type is now also a free text column. If it happens to contains legacy lease data, then we apply a special logic to the blob. The classes used for storing/versioning liquidity ads data are moved in a liquidity ads package. The serialiser for LiquidityAds.FundingFee has been removed (instead we use the same pattern as the other liquidity data). The methods from moving to the canonical data to the versioned db data have been rename: asDb(), asCanonical().
- Loading branch information
Showing
13 changed files
with
335 additions
and
304 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
213 changes: 0 additions & 213 deletions
213
src/commonMain/kotlin/fr/acinq/lightning/bin/db/payments/InboundLiquidityPurchaseType.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
src/commonMain/kotlin/fr/acinq/lightning/bin/db/payments/liquidityads/FundingFeeData.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
@file:UseSerializers( | ||
MilliSatoshiSerializer::class, | ||
TxIdSerializer::class, | ||
) | ||
|
||
package fr.acinq.lightning.bin.db.payments.liquidityads | ||
|
||
import fr.acinq.bitcoin.TxId | ||
import fr.acinq.lightning.MilliSatoshi | ||
import fr.acinq.lightning.bin.db.serializers.v1.MilliSatoshiSerializer | ||
import fr.acinq.lightning.bin.db.serializers.v1.TxIdSerializer | ||
import fr.acinq.lightning.wire.LiquidityAds | ||
import kotlinx.serialization.Serializable | ||
import kotlinx.serialization.UseSerializers | ||
|
||
@Serializable | ||
sealed class FundingFeeData { | ||
|
||
@Serializable | ||
data class V0(val amount: MilliSatoshi, val fundingTxId: TxId) : FundingFeeData() | ||
|
||
companion object { | ||
fun FundingFeeData.asCanonical(): LiquidityAds.FundingFee = when (this) { | ||
is V0 -> LiquidityAds.FundingFee(amount = amount, fundingTxId = fundingTxId) | ||
} | ||
fun LiquidityAds.FundingFee.asDb(): FundingFeeData = V0(amount = amount, fundingTxId = fundingTxId) | ||
} | ||
} |
Oops, something went wrong.