Skip to content

Commit

Permalink
Merge pull request #459 from bitcoin-sv/refactor/monitor-peers
Browse files Browse the repository at this point in the history
Refactor/monitor peers
  • Loading branch information
boecklim authored Jun 11, 2024
2 parents 20249b3 + eded940 commit 955e004
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
15 changes: 12 additions & 3 deletions cmd/arc/services/metamorph.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,7 @@ func StartMetamorph(logger *slog.Logger) (func(), error) {
return nil, err
}

metamorphProcessor, err := metamorph.NewProcessor(
metamorphStore,
pm,
processorOpts := []metamorph.Option{
metamorph.WithCacheExpiryTime(mapExpiry),
metamorph.WithSeenOnNetworkTxTimeUntil(seenOnNetworkOlderThan),
metamorph.WithSeenOnNetworkTxTime(checkSeenOnNetworkPeriod),
Expand All @@ -146,6 +144,17 @@ func StartMetamorph(logger *slog.Logger) (func(), error) {
metamorph.WithStatTimeLimits(statsNotSeenTimeLimit, statsNotMinedTimeLimit),
metamorph.WithMaxRetries(maxRetries),
metamorph.WithMinimumHealthyConnections(minimumHealthyConnections),
}

monitorPeersInterval := viper.GetDuration("metamorph.monitorPeersInterval")
if monitorPeersInterval != 0 {
processorOpts = append(processorOpts, metamorph.WithMonitorPeersInterval(monitorPeersInterval))
}

metamorphProcessor, err := metamorph.NewProcessor(
metamorphStore,
pm,
processorOpts...,
)
if err != nil {
return nil, err
Expand Down
11 changes: 6 additions & 5 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ metamorph:
listenAddr: localhost:8001 # address space for metamorph to listen on. Can be for example localhost:8001 or :8001 for listening on all addresses
dialAddr: localhost:8001 # address for other services to dial metamorph service
db:
mode: postgres # db mode inidicates which db to use. At the moment only postgres is offered
mode: postgres # db mode indicates which db to use. At the moment only postgres is offered
postgres: # postgres db configuration in case that mode: postgres
host: localhost
port: 5432
Expand All @@ -43,10 +43,11 @@ metamorph:
maxOpenConns: 80 # maximum open connections
sslMode: disable
processorCacheExpiryTime: 24h # time after which processor cache is cleaned
maxRetries: 1000 # maximum number of times a trasnaction is re-broadcasted
processStatusUpdateInterval: 5s # interval of procesing status updates
checkSeenOnNetworkOlderThan: 3h # transactions with SEEN_ON_NETWORK status will be re-requested from blocktx which are older than checkSeenOnNetworkOlderThan hours
checkSeenOnNetworkPeriod: 4h # transactions with SEEN_ON_NETWORK status will be re-requested from blocktx which are inserted in the last checkSeenOnNetworkPeriod hours
maxRetries: 1000 # maximum number of times a transaction is re-broadcasted
processStatusUpdateInterval: 5s # interval of processing status updates
checkSeenOnNetworkOlderThan: 3h # transactions with SEEN_ON_NETWORK status will be re-requested from blocktx which are older than checkSeenOnNetworkOlderThan
checkSeenOnNetworkPeriod: 4h # transactions with SEEN_ON_NETWORK status will be re-requested from blocktx which are inserted in the last checkSeenOnNetworkPeriod
monitorPeersInterval: 60s # interval in which health of peers is checked (optional, default: 60s)
checkUtxos: false # force check each utxo for validity. If enabled ARC connects to bitcoin node using rpc for each utxo
profilerAddr: localhost:9992 # address to start profiler server on
health:
Expand Down

0 comments on commit 955e004

Please sign in to comment.