Commit 8403d2d
committed
Offload BDK wallet calls to blocking threads
gdb sampling showed a tokio worker pinned at 100%
CPU inside BDK's CheckPointIter::next, called from
poll_and_update_listeners_inner every 2s. The iterator walks
an O(T*C) linked list (txs * checkpoints) under the wallet
mutex, blocking the async runtime the entire time.
Move get_unconfirmed_txids() and apply_mempool_txs() into
spawn_blocking so they run on the blocking thread pool
instead. The Electrum chain source already does this for its
equivalent BDK calls; bitcoind was the odd one out.1 parent 735bb99 commit 8403d2d
1 file changed
Lines changed: 23 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
436 | 436 | | |
437 | 437 | | |
438 | 438 | | |
439 | | - | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
440 | 450 | | |
441 | 451 | | |
442 | 452 | | |
| |||
450 | 460 | | |
451 | 461 | | |
452 | 462 | | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | | - | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
458 | 475 | | |
459 | 476 | | |
460 | 477 | | |
| |||
0 commit comments