Skip to content

Commit

Permalink
config: make block prefetch the default.
Browse files Browse the repository at this point in the history
Remove --dcrd-block-prefetch/-P, and add --no-dcrd-block-prefetch.
  • Loading branch information
chappjc committed May 18, 2019
1 parent ad06c8c commit 5ceb56b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ type config struct {
DcrdServ string `long:"dcrdserv" description:"Hostname/IP and port of dcrd RPC server to connect to (default localhost:9109, testnet: localhost:19109, simnet: localhost:19556)" env:"DCRDATA_DCRD_URL"`
DcrdCert string `long:"dcrdcert" description:"File containing the dcrd certificate file" env:"DCRDATA_DCRD_CERT"`
DisableDaemonTLS bool `long:"nodaemontls" description:"Disable TLS for the daemon RPC client -- NOTE: This is only allowed if the RPC client is connecting to localhost" env:"DCRDATA_DCRD_DISABLE_TLS"`
BlockPrefetch bool `long:"dcrd-block-prefetch" short:"P" description:"Pre-fetch blocks from dcrd during startup sync."`
NoBlockPrefetch bool `long:"no-dcrd-block-prefetch" description:"Disable block pre-fetch from dcrd during startup sync."`

// ExchangeBot settings
EnableExchangeBot bool `long:"exchange-monitor" description:"Enable the exchange monitor" env:"DCRDATA_MONITOR_EXCHANGES"`
Expand Down
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -894,16 +894,16 @@ func _main(ctx context.Context) error {

// Use either the plain rpcclient.Client or a rpcutils.BlockPrefetchClient.
var bf rpcutils.BlockFetcher
if cfg.BlockPrefetch {
if cfg.NoBlockPrefetch {
bf = dcrdClient
} else {
pfc := rpcutils.NewBlockPrefetchClient(dcrdClient)
defer func() {
pfc.Stop()
log.Debugf("Block prefetcher hits = %d, misses = %d.",
pfc.Hits(), pfc.Misses())
}()
bf = pfc
} else {
bf = dcrdClient
}

// Synchronization between DBs via rpcutils.BlockGate
Expand Down

0 comments on commit 5ceb56b

Please sign in to comment.