Project Flow and Feature Changes
Background
- btcd has added support for batched JSON-RPC requests, letting clients send multiple requests (e.g., for block hashes or blocks) in one network round-trip.
- bitcoind already supported this; now btcd and its clients (such as lnd) can benefit from request pipelining.
- The lnd codebase, especially the chainntnfs package, is updated to utilize this batched request capability.
Feature Goals
- Speed up rescans/notifications: Use batched requests to fetch blocks, transactions, or hashes more efficiently during:
- Manual confirmation rescans
- Spend notification rescans
- Historical lookups
- Extend to btcwallet: Accelerate wallet initialization, seed imports, and on-demand rescans by batching network calls.
Key Code Changes
- chainntnfs/bitcoindnotify/bitcoind.go:
- Instead of sending single block hash requests in a loop, the code now batches
GetBlockHashAsync requests, then sends all at once via SendAsyncQueue.
- Blocks are fetched in batches (e.g., 15 at a time) using
GetBlocksBatch to avoid memory exhaustion.
- The logic for iterating over blocks and extracting transaction/spend details is adapted for batch results.
- chainntnfs/bitcoindnotify/bitcoind_test.go:
- New/updated tests ensure batching works, especially when txindex is disabled, confirming that manual rescans are still correct and faster.
- go.mod:
btcwallet replaced with a fork supporting batch JSON-RPC.
- Comments explain use of batch JSON-RPC and security advisory-related replacements.
Sequence Diagram

Test Results Comparison
Before (Single Requests)
- Each block hash or block fetched via separate JSON-RPC call.