Commit 1a29ef4
authored
Surface outbound payment events via next_event() (#34)
Previously, PaymentSuccessful events from LDK were silently ACKed
and discarded by next_event()'s catch-all arm. This meant callers
using the event-polling model (as opposed to the blocking
wait_for_payment_outcome path) could never learn when an outbound
payment completed or obtain its preimage.
This is a prerequisite for making agent-wallet payments
non-blocking: instead of calling payWhileRunning with a 30-second
timeout that blocks the Node.js thread and risks losing the
preimage on timeout, the agent-wallet will fire-and-forget the
payment and pick up the result through the event loop.
Add a Sent variant (discriminant 3) to PaymentEventType and map
Event::PaymentSuccessful to it in next_event(), carrying the
payment_id and preimage. Also extend PaymentEvent with payment_id
and preimage fields, and expose the previously-discarded payment_id
on PaymentFailed events so callers can correlate failures to
specific outbound payments.
All new fields are Option and set to None on Claimable/Received
events, so this is backwards-compatible for existing consumers
that only match on the first three variants.1 parent 207542d commit 1a29ef4
2 files changed
Lines changed: 31 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
56 | 60 | | |
57 | 61 | | |
58 | 62 | | |
59 | 63 | | |
60 | 64 | | |
| 65 | + | |
61 | 66 | | |
62 | 67 | | |
63 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
307 | 307 | | |
308 | 308 | | |
309 | 309 | | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
310 | 314 | | |
311 | 315 | | |
312 | 316 | | |
313 | 317 | | |
314 | 318 | | |
315 | 319 | | |
316 | 320 | | |
| 321 | + | |
317 | 322 | | |
318 | 323 | | |
319 | 324 | | |
| |||
463 | 468 | | |
464 | 469 | | |
465 | 470 | | |
| 471 | + | |
| 472 | + | |
466 | 473 | | |
467 | 474 | | |
468 | 475 | | |
| |||
490 | 497 | | |
491 | 498 | | |
492 | 499 | | |
| 500 | + | |
| 501 | + | |
493 | 502 | | |
494 | 503 | | |
495 | 504 | | |
| 505 | + | |
496 | 506 | | |
497 | 507 | | |
498 | 508 | | |
| |||
502 | 512 | | |
503 | 513 | | |
504 | 514 | | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
505 | 531 | | |
506 | 532 | | |
507 | 533 | | |
| |||
0 commit comments