mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-29 19:43:23 +02:00
Puts the ZapValue calculator inside a caching function.
This commit is contained in:
@@ -33,12 +33,17 @@ class LnZapEvent(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun amount(): BigDecimal? {
|
override fun amount(): BigDecimal? {
|
||||||
return lnInvoice()?.let { LnInvoiceUtil.getAmountInSats(it) }
|
return amount
|
||||||
}
|
}
|
||||||
|
|
||||||
// Keeps this as a field because it's a heavier function used everywhere.
|
// Keeps this as a field because it's a heavier function used everywhere.
|
||||||
val amount by lazy {
|
val amount by lazy {
|
||||||
lnInvoice()?.let { LnInvoiceUtil.getAmountInSats(it) }
|
try {
|
||||||
|
lnInvoice()?.let { LnInvoiceUtil.getAmountInSats(it) }
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Log.e("LnZapEvent", "Failed to Parse LnInvoice ${description()}", e)
|
||||||
|
null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun containedPost(): Event? = try {
|
override fun containedPost(): Event? = try {
|
||||||
|
Reference in New Issue
Block a user