-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathconst.go
More file actions
175 lines (151 loc) · 6.78 KB
/
const.go
File metadata and controls
175 lines (151 loc) · 6.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
package main
import "time"
const (
poolSoftwareName = "goPool"
// Duplicate share detection: track last N submissions per job (LRU eviction).
duplicateShareHistory = 100
evictedShareCacheGrace = time.Minute // keep caches for evicted jobs to catch late duplicates
workerPageCacheLimit = 100
// Config defaults.
defaultListenAddr = ":3333"
defaultStatusAddr = ":80"
defaultStatusTLSAddr = ":443"
defaultStatusTagline = "Solo Mining Pool"
defaultFiatCurrency = "usd"
defaultGitHubURL = "https://github.com/Distortions81/M45-Core-goPool/blob/main/README.md"
defaultMempoolAddressURL = "https://mempool.space/address/"
defaultStratumTLSListen = ":4333"
defaultRPCURL = "http://127.0.0.1:8332"
defaultExtranonce2Size = 4
defaultTemplateExtraNonce2Size = 8
defaultPoolFeePercent = 2.0
defaultRecentJobs = 10
defaultConnectionTimeout = 3 * time.Minute
// Accept rate limiting defaults.
defaultMaxAcceptsPerSecond = 500
defaultMaxAcceptBurst = 1000
defaultAcceptReconnectWindow = 15
defaultAcceptBurstWindow = 5
defaultAcceptSteadyStateWindow = 100
defaultAcceptSteadyStateRate = 50
defaultAcceptSteadyStateReconnectPercent = 5.0
defaultAcceptSteadyStateReconnectWindow = 60
defaultStratumMessagesPerMinute = 0
defaultJobEntropy = 4
maxJobEntropy = 16
defaultCoinbaseScriptSigMaxBytes = 100
defaultMaxConns = 50000
// Ban thresholds.
defaultShareNTimeMaxForwardSeconds = 7000
defaultBanInvalidSubmissionsAfter = 40
defaultBanInvalidSubmissionsWindow = 5 * time.Minute
defaultBanInvalidSubmissionsDuration = 15 * time.Minute
// Accepted-share forgiveness for invalid-submission bans:
// every N accepted shares reduce effective invalid count by 1, up to a cap.
banInvalidForgiveSharesPerUnit = 2
banInvalidForgiveCapFraction = 0.5
defaultReconnectBanThreshold = 60
defaultReconnectBanWindowSeconds = 60
defaultReconnectBanDurationSeconds = 3600
defaultDiscordWorkerNotifyThresholdSeconds = 300
defaultMaxDifficulty = 0
defaultMinDifficulty = 256.0
defaultMinVersionBits = 1
defaultRefreshInterval = 10 * time.Second
defaultZMQReceiveTimeout = 15 * time.Second
defaultZMQConnectTimeout = 5 * time.Second
// ZMQ tuning: heartbeats detect dead peers faster than TCP; backoff avoids spamming during restarts.
defaultZMQHeartbeatInterval = 5 * time.Second
defaultZMQHeartbeatTimeout = 15 * time.Second
defaultZMQHeartbeatTTL = 30 * time.Second
defaultZMQReconnectInterval = 1 * time.Second
defaultZMQReconnectMax = 10 * time.Second
defaultZMQRecreateBackoffMin = 500 * time.Millisecond
defaultZMQRecreateBackoffMax = 10 * time.Second
defaultInitialDifficultyDelay = 250 * time.Millisecond
// stratumHeartbeatInterval is how often we do a non-longpoll template refresh
// to prove the node is responsive even when the template doesn't change.
stratumHeartbeatInterval = 30 * time.Second
// stratumStartupGrace is a boot grace window during which we do not treat
// "no job yet" / "node degraded" as actionable for disconnecting/refusing
// miners or showing node-down UI. This avoids noisy false alarms while the
// pool and node are still starting up.
stratumStartupGrace = 5 * time.Minute
// stratumStaleJobGrace is the single runtime grace window before Stratum
// starts refusing new miners or disconnecting existing miners due to node/job
// feed health issues. This keeps transient hiccups from kicking users.
stratumStaleJobGrace = 5 * time.Minute
defaultZMQHashBlockAddr = "tcp://127.0.0.1:28334"
defaultZMQRawBlockAddr = "tcp://127.0.0.1:28332"
defaultAutoAcceptRateLimits = true
defaultOperatorDonationPercent = 0.0
defaultPeerCleanupEnabled = false
defaultPeerCleanupMaxPingMs = 250
defaultPeerCleanupMinPeers = 30
// VarDiff defaults.
defaultVarDiffTargetSharesPerMin = 15
defaultVarDiffAdjustmentWindow = 60 * time.Second
defaultVarDiffStep = 2
defaultVarDiffDampingFactor = 0.7
defaultVarDiffRetargetDelay = 30 * time.Second
defaultDifficultyStepGranularity = 4
vardiffAdaptiveMinWindow = 30 * time.Second
vardiffAdaptiveMaxWindow = 4 * time.Minute
vardiffAdaptiveHighShareCount = 24.0
vardiffAdaptiveLowShareCount = 6.0
vardiffLowHashrateExpectedShares = 8.0
vardiffLowHashrateMinAccepted = 3
// Safety rails for vardiff decisions to avoid extreme share cadences.
// - below min shares/min can cause long no-share gaps and miner timeouts.
// - above max shares/min can spam submits and overload the pool.
vardiffSafetyMinSharesPerMin = 2.0
vardiffSafetyMaxSharesPerMin = 30.0
vardiffLargeUpJumpFactor = 4.0
vardiffLargeUpCooldown = 2 * time.Minute
vardiffHighWarmupP95MS = 12000.0
vardiffHighWarmupSamplesMin = 8
vardiffHighWarmupStreakNeed = 3
vardiffWarmupDownwardBias = 0.93
vardiffTimeoutGuardMinQuiet = 20 * time.Second
vardiffTimeoutGuardLead = 5 * time.Second
vardiffTimeoutGuardThreshold = 0.7
vardiffTimeoutGuardMaxPZero = 0.01
vardiffUncertaintyAbsRatio = 2.0
vardiffUncertaintyMinSamples = 4
hashrateControlTauFactor = 0.35
hashrateControlTauMin = 45 * time.Second
startupDiffPrimingFactor = 0.75
startupDiffPrimingMinFactor = 0.60
defaultHashrateEMATauSeconds = 450.0
initialHashrateEMATau = 45 * time.Second
// statusWindowIdleReset bounds stale status-window carryover after long
// no-share gaps; it is intentionally independent from vardiff retargeting.
statusWindowIdleReset = 15 * time.Minute
// When anchoring a fresh sampling window after reset, place WindowStart at
// this percent of the elapsed time from reset to first share (0-100).
windowStartLagPercent = 66
maxStratumMessageSize = 64 * 1024
stratumWriteTimeout = 60 * time.Second
defaultVersionMask = uint32(0x1fffe000)
minMinerTimeout = 30 * time.Second
// Grace periods for new/changing connections.
initialReadTimeout = 90 * time.Second // kick idle connections that never submit valid shares
previousDiffGracePeriod = time.Minute // accept shares at old difficulty briefly after a change
earlySubmitHalfWeightWindow = defaultVarDiffAdjustmentWindow * 4
stratumFloodLimitMultiplier = 2
defaultBackblazeBackupIntervalSeconds = 12 * 60 * 60
defaultSavedWorkerHistoryFlushInterval = 3 * time.Hour
// Input validation limits.
maxMinerClientIDLen = 256
maxWorkerNameLen = 256
maxJobIDLen = 128
maxVersionHexLen = 8
maxDuplicateShareKeyBytes = 64
forceClerkLoginUIForTesting = false
clerkDevSessionTokenTTL = 12 * time.Hour // localhost dev sessions only
)
const (
shareJobFreshnessOff = iota
shareJobFreshnessJobID
shareJobFreshnessJobIDPrev
)