Skip to content

Commit b9f17c3

Browse files
author
Conor Okus
authored
Merge pull request #159 from tnull/2022-08-update-events-to-handle
Update list of `Event`s to handle in tutorials.
2 parents c83b4a7 + 1c54a48 commit b9f17c3

File tree

2 files changed

+37
-5
lines changed

2 files changed

+37
-5
lines changed

docs/tutorials/build_a_node_in_java.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,24 +167,48 @@ class YourObj implements ChannelManagerConstructor.EventHandler {
167167
else if (e instanceof Event.PaymentReceived) {
168168
// <insert code to handle this event>
169169
}
170+
else if (e instanceof Event.PaymentClaimed) {
171+
// <insert code to handle this event>
172+
}
170173
else if (e instanceof Event.PaymentSent) {
171174
// <insert code to handle this event>
172175
}
176+
else if (e instanceof Event.PaymentFailed) {
177+
// <insert code to handle this event>
178+
}
179+
else if (e instanceof Event.PaymentPathSuccessful) {
180+
// <insert code to handle this event>
181+
}
173182
else if (e instanceof Event.PaymentPathFailed) {
174183
// <insert code to handle this event>
175184
}
185+
else if (e instanceof Event.ProbeSuccessful) {
186+
// <insert code to handle this event>
187+
}
188+
else if (e instanceof Event.ProbeFailed) {
189+
// <insert code to handle this event>
190+
}
191+
else if (e instanceof Event.HTLCHandlingFailed) {
192+
// <insert code to handle this event>
193+
}
176194
else if (e instanceof Event.PendingHTLCsForwardable) {
177195
// <insert code to handle this event>
178196
}
179197
else if (e instanceof Event.SpendableOutputs) {
180198
// <insert code to handle this event>
181199
}
200+
else if (e instanceof Event.OpenChannelRequest) {
201+
// <insert code to handle this event>
202+
}
182203
else if (e instanceof Event.PaymentForwarded) {
183204
// <insert code to handle this event>
184205
}
185206
else if (e instanceof Event.ChannelClosed) {
186207
// <insert code to handle this event>
187208
}
209+
else if (e instanceof Event.DiscardFunding) {
210+
// <insert code to handle this event>
211+
}
188212
}
189213

190214
@Override
@@ -208,7 +232,7 @@ ChannelManagerConstructor.EventHandler customEventHandler = new YourObj();
208232
* It's important to read the documentation (linked in References) for each event
209233
to make sure you satisfy the API requirements for handling it
210234

211-
**References:** [Example of handling LDK events in Rust](https://github.com/lightningdevkit/ldk-sample/blob/bc07db6ca4a3323d8718a27f85182b8157a20750/src/main.rs#L101-L240),
235+
**References:** [Example of handling LDK events in Rust](https://github.com/lightningdevkit/ldk-sample/blob/39dda99b6977b8d976f4827486004503da91a760/src/main.rs#L115-L356),
212236
[Rust docs for LDK events](https://docs.rs/lightning/*/lightning/util/events/enum.Event.html)
213237

214238
### 7. Optional: Initialize the Transaction `Filter`

docs/tutorials/build_a_node_in_rust.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -672,12 +672,20 @@ fn handle_ldk_event(..) {
672672
match event {
673673
Event::FundingGenerationReady { .. } => { .. }, // insert handling code
674674
Event::PaymentReceived { .. } => { .. }, // insert handling code
675+
Event::PaymentClaimed { .. } => { .. }, // insert handling code
675676
Event::PaymentSent { .. } => { .. }, // insert handling code
677+
Event::PaymentFailed { .. } => { .. }, // insert handling code
678+
Event::PaymentPathSuccessful { .. } => { .. }, // insert handling code
676679
Event::PaymentPathFailed { .. } => { .. }, // insert handling code
680+
Event::ProbeSuccessful { .. } => { .. }, // insert handling code
681+
Event::ProbeFailed { .. } => { .. }, // insert handling code
682+
Event::HTLCHandlingFailed { .. } => { .. }, // insert handling code
677683
Event::PendingHTLCsForwardable { .. } => { .. }, // insert handling code
678-
Event::SpendableOutputs { .. } => { .. } // insert handling code
679-
Event::PaymentForwarded { .. } => { .. } // insert handling code
680-
Event::ChannelClosed { .. } => { .. } // insert handling code
684+
Event::SpendableOutputs { .. } => { .. }, // insert handling code
685+
Event::OpenChannelRequest { .. } => { .. }, // insert handling code
686+
Event::PaymentForwarded { .. } => { .. }, // insert handling code
687+
Event::ChannelClosed { .. } => { .. }, // insert handling code
688+
Event::DiscardFunding { .. } => { .. }, // insert handling code
681689
}
682690
}
683691
```
@@ -688,7 +696,7 @@ fn handle_ldk_event(..) {
688696

689697
**Dependencies:** `ChannelManager`, `ChainMonitor`, `KeysManager`, `BroadcasterInterface`
690698

691-
**References:** [`Event` docs](https://docs.rs/lightning/*/lightning/util/events/enum.Event.html), [`EventHandler` docs](https://docs.rs/lightning/*/lightning/util/events/trait.EventHandler.html),[LDK sample node event handling example](https://github.com/lightningdevkit/ldk-sample/blob/bc07db6ca4a3323d8718a27f85182b8157a20750/src/main.rs#L101-L240)
699+
**References:** [`Event` docs](https://docs.rs/lightning/*/lightning/util/events/enum.Event.html), [`EventHandler` docs](https://docs.rs/lightning/*/lightning/util/events/trait.EventHandler.html),[LDK sample node event handling example](https://github.com/lightningdevkit/ldk-sample/blob/39dda99b6977b8d976f4827486004503da91a760/src/main.rs#L115-L356)
692700

693701
### Step 16. Initialize the `ProbabilisticScorer`
694702
**What it's used for:** to find a suitable payment path to reach the destination.

0 commit comments

Comments
 (0)