lib: fix unspent txout crash

This commit is contained in:
Oscar Mira 2023-05-29 02:48:35 +02:00
parent 6811bdf47a
commit aa5ea643cc

View File

@ -19,17 +19,17 @@ constructor(
val spentInBlockHeight: Long,
) : Parcelable {
init {
require(blockHeight <= spentInBlockHeight)
require(amount >= 0) { "TX amount cannot be negative" }
}
@IgnoredOnParcel
val spent: Boolean = spentInBlockHeight != 0L
@IgnoredOnParcel
val notSpent = !spent
init {
require(notSpent || blockHeight <= spentInBlockHeight)
require(amount >= 0) { "TX amount $amount cannot be negative" }
}
override fun equals(other: Any?): Boolean {
if (this === other) return true
if (javaClass != other?.javaClass) return false