Skip to content

Commit

Permalink
neutrino: improve perf in high latency networks
Browse files Browse the repository at this point in the history
  • Loading branch information
djkazic committed May 29, 2024
1 parent a2d891c commit 33c1869
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion neutrino.go
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ func NewChainService(cfg Config) (*ChainService, error) {
if s.persistToDisk {
cfg := &chanutils.BatchWriterConfig[*filterdb.FilterData]{
QueueBufferSize: chanutils.DefaultQueueSize,
MaxBatch: 1000,
MaxBatch: 10,
DBWritesTickerDuration: time.Millisecond * 500,
PutItems: s.FilterDB.PutFilters,
}
Expand Down
4 changes: 2 additions & 2 deletions query.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var (
// each peer before we've concluded we aren't going to get a valid
// response. This allows to make up for missed messages in some
// instances.
QueryNumRetries = 2
QueryNumRetries = 8

// QueryPeerConnectTimeout specifies how long to wait for the
// underlying chain service to connect to a peer before giving up
Expand Down Expand Up @@ -294,7 +294,7 @@ func (s *ChainService) queryAllPeers(
// Starting with the set of default options, we'll apply any specified
// functional options to the query.
qo := defaultQueryOptions()
qo.numRetries = 1
qo.numRetries = 8
qo.applyQueryOptions(options...)

// This is done in a single-threaded query because the peerState is
Expand Down
2 changes: 1 addition & 1 deletion rescan.go
Original file line number Diff line number Diff line change
Expand Up @@ -956,7 +956,7 @@ func (rs *rescanState) handleBlockConnected(ntfn *blockntfns.Connected) error {

// Otherwise, we'll attempt to fetch the filter to retrieve the relevant
// transactions and notify them.
queryOptions := NumRetries(0)
queryOptions := NumRetries(2)
blockFilter, err := chain.GetCFilter(
newStamp.Hash, wire.GCSFilterRegular, queryOptions,
)
Expand Down
2 changes: 1 addition & 1 deletion sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var (
// well. Keep in mind some log messages may not appear in order due to
// use of multiple query goroutines in the tests.
logLevel = btclog.LevelOff
syncTimeout = 30 * time.Second
syncTimeout = 300 * time.Second
syncUpdate = time.Second

dbOpenTimeout = time.Second * 10
Expand Down

0 comments on commit 33c1869

Please sign in to comment.