Commit 9cda45b
authored
Remove sync_wallets from hot paths (#35)
sync_wallets() issues serial HTTP requests to Esplora (fee rate
estimation, lightning tx sync across multiple block heights, BDK
wallet sync). This blocks the NAPI thread for a few seconds
via runtime.block_on(), which prevents the JS event loop from
polling nextEvent() for incoming HTLCs.
The 10+ second payment latency observed traces directly
to this: the sender's HTLC sits unprocessed while the receiver
node grinds through chain sync before the webhook handler can
start its event loop.
Removed sync_wallets from start_receiving, receive_payment,
get_invoice, and execute_payment. Receiving HTLCs only needs a
peer connection and channel manager, both provided by
node.start(). Sending payments routes via the gossip graph with
fee rates already cached by node.start().
LDK uses highest_seen_timestamp (set via best_block_updated) for
inbound payment verification with a 2-hour grace window. A stale
chain tip could cause valid payments to be rejected as expired.1 parent 9aee191 commit 9cda45b
1 file changed
Lines changed: 1 addition & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
679 | 679 | | |
680 | 680 | | |
681 | 681 | | |
| 682 | + | |
682 | 683 | | |
683 | 684 | | |
684 | 685 | | |
| |||
1050 | 1051 | | |
1051 | 1052 | | |
1052 | 1053 | | |
1053 | | - | |
1054 | | - | |
1055 | | - | |
1056 | | - | |
1057 | | - | |
1058 | 1054 | | |
1059 | 1055 | | |
1060 | 1056 | | |
| |||
1181 | 1177 | | |
1182 | 1178 | | |
1183 | 1179 | | |
1184 | | - | |
1185 | | - | |
1186 | | - | |
1187 | | - | |
1188 | 1180 | | |
1189 | 1181 | | |
1190 | 1182 | | |
| |||
1487 | 1479 | | |
1488 | 1480 | | |
1489 | 1481 | | |
1490 | | - | |
1491 | | - | |
1492 | | - | |
1493 | | - | |
1494 | | - | |
1495 | | - | |
1496 | | - | |
1497 | | - | |
1498 | | - | |
1499 | 1482 | | |
1500 | 1483 | | |
1501 | 1484 | | |
| |||
0 commit comments