mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-04-21 22:14:43 +02:00
Puts the ZapValue calculator inside a caching function.
This commit is contained in:
parent
57ee0ff1ff
commit
78261ccd94
@ -33,12 +33,17 @@ class LnZapEvent(
|
||||
}
|
||||
|
||||
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.
|
||||
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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user