Skip to content

Commit

Permalink
add events PaymentEvents.PaymentSent
Browse files Browse the repository at this point in the history
  • Loading branch information
pm47 committed Sep 26, 2024
1 parent 8455d5c commit 4f615be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/commonMain/kotlin/fr/acinq/lightning/NodeEvents.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import fr.acinq.lightning.channel.states.ChannelStateWithCommitments
import fr.acinq.lightning.channel.states.Normal
import fr.acinq.lightning.channel.states.WaitForFundingCreated
import fr.acinq.lightning.db.IncomingPayment
import fr.acinq.lightning.db.OutgoingPayment
import fr.acinq.lightning.utils.sum
import fr.acinq.lightning.wire.Init
import fr.acinq.lightning.wire.LiquidityAds
Expand Down Expand Up @@ -50,7 +51,7 @@ sealed interface LiquidityEvents : NodeEvents {
data class TooManyParts(val parts: Int) : Reason()
}
}
data class Purchased(val purchase: LiquidityAds.Purchase) : PaymentEvents
data class Purchased(val purchase: LiquidityAds.Purchase) : LiquidityEvents
}

/** This is useful on iOS to ask the OS for time to finish some sensitive tasks. */
Expand All @@ -73,4 +74,5 @@ sealed interface PaymentEvents : NodeEvents {
val amount: MilliSatoshi = receivedWith.map { it.amountReceived }.sum()
val fees: MilliSatoshi = receivedWith.map { it.fees }.sum()
}
data class PaymentSent(val payment: OutgoingPayment) : PaymentEvents
}
1 change: 1 addition & 0 deletions src/commonMain/kotlin/fr/acinq/lightning/io/Peer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,7 @@ class Peer(
)
}
}
nodeParams._nodeEvents.emit(PaymentEvents.PaymentSent(payment))
db.payments.addOutgoingPayment(payment)
}
is ChannelAction.Storage.SetLocked -> {
Expand Down

0 comments on commit 4f615be

Please sign in to comment.