Skip to content

Update list of Events to handle in tutorials. #159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion docs/tutorials/build_a_node_in_java.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,24 +167,48 @@ class YourObj implements ChannelManagerConstructor.EventHandler {
else if (e instanceof Event.PaymentReceived) {
// <insert code to handle this event>
}
else if (e instanceof Event.PaymentClaimed) {
// <insert code to handle this event>
}
else if (e instanceof Event.PaymentSent) {
// <insert code to handle this event>
}
else if (e instanceof Event.PaymentFailed) {
// <insert code to handle this event>
}
else if (e instanceof Event.PaymentPathSuccessful) {
// <insert code to handle this event>
}
else if (e instanceof Event.PaymentPathFailed) {
// <insert code to handle this event>
}
else if (e instanceof Event.ProbeSuccessful) {
// <insert code to handle this event>
}
else if (e instanceof Event.ProbeFailed) {
// <insert code to handle this event>
}
else if (e instanceof Event.HTLCHandlingFailed) {
// <insert code to handle this event>
}
else if (e instanceof Event.PendingHTLCsForwardable) {
// <insert code to handle this event>
}
else if (e instanceof Event.SpendableOutputs) {
// <insert code to handle this event>
}
else if (e instanceof Event.OpenChannelRequest) {
// <insert code to handle this event>
}
else if (e instanceof Event.PaymentForwarded) {
// <insert code to handle this event>
}
else if (e instanceof Event.ChannelClosed) {
// <insert code to handle this event>
}
else if (e instanceof Event.DiscardFunding) {
// <insert code to handle this event>
}
}

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

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

### 7. Optional: Initialize the Transaction `Filter`
Expand Down
16 changes: 12 additions & 4 deletions docs/tutorials/build_a_node_in_rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -672,12 +672,20 @@ fn handle_ldk_event(..) {
match event {
Event::FundingGenerationReady { .. } => { .. }, // insert handling code
Event::PaymentReceived { .. } => { .. }, // insert handling code
Event::PaymentClaimed { .. } => { .. }, // insert handling code
Event::PaymentSent { .. } => { .. }, // insert handling code
Event::PaymentFailed { .. } => { .. }, // insert handling code
Event::PaymentPathSuccessful { .. } => { .. }, // insert handling code
Event::PaymentPathFailed { .. } => { .. }, // insert handling code
Event::ProbeSuccessful { .. } => { .. }, // insert handling code
Event::ProbeFailed { .. } => { .. }, // insert handling code
Event::HTLCHandlingFailed { .. } => { .. }, // insert handling code
Event::PendingHTLCsForwardable { .. } => { .. }, // insert handling code
Event::SpendableOutputs { .. } => { .. } // insert handling code
Event::PaymentForwarded { .. } => { .. } // insert handling code
Event::ChannelClosed { .. } => { .. } // insert handling code
Event::SpendableOutputs { .. } => { .. }, // insert handling code
Event::OpenChannelRequest { .. } => { .. }, // insert handling code
Event::PaymentForwarded { .. } => { .. }, // insert handling code
Event::ChannelClosed { .. } => { .. }, // insert handling code
Event::DiscardFunding { .. } => { .. }, // insert handling code
}
}
```
Expand All @@ -688,7 +696,7 @@ fn handle_ldk_event(..) {

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

**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)
**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)

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