btcsuite / btcwallet

A secure bitcoin wallet daemon written in Go (golang)
ISC License
1.15k stars 590 forks source link

chain: use batch rpc client in mempool poller #888

Closed yyforyongyu closed 1 year ago

yyforyongyu commented 1 year ago

This PR replaces the normal client with a batch client created from rpcclient.NewBatch. All the getrawtransaction requests are now batched with a default size of 10,000, and the batch will wait for 1 second before attempting the next one.

This change is made so less pressure is placed on bitcoind as when the mempool is full, there will be loads of getrawtransaction calls made, resulting in a slow response for other RPC calls such as getblockchaininfo, causing issues in other systems.

The mod files are also updated and a similar check is added here(copied from lnd)

Roasbeef commented 1 year ago

cc @ellemouton

saubyk commented 1 year ago

cc @Crypt-iQ for review. thanks

Crypt-iQ commented 1 year ago

Needs a rebase since the gettxspendingprevout change landed