signet/miner: reduce default interblock interval limit to 30min#26208
signet/miner: reduce default interblock interval limit to 30min#26208fanquake merged 1 commit intobitcoin:masterfrom
Conversation
Also allow the operator to change it, if desired, without having to edit the code.
|
signet/miner --poisson attempts to simulate the distribution of times you'd see on mainnet. My original reasoning for the 60 minute cap is that you only expect 0.25% of blocks to take that long, so what does it matter. With a lower cap it seems worthwhile checking what that effects. I think you can work out the expected average with a cap as follows: def expected_times(tgt, N=100000):
return [tgt*-math.log(1-i*1.0/N) for i in range(N)]
def capped_average(seq, cap):
sum, cnt = 0,0
for v in seq:
sum += min(v, cap)
cnt += 1
return sum/cnt
def bisect(f, want, l=0, h=100000, prec=0.0005):
while l + prec < h:
m = (l + h)/2
if f(m) < want:
l = m
else:
h = m
return h
for cap in [11, 15, 16, 20, 25, 30, 45, 60]:
tgt = bisect(lambda t: capped_average(expected_times(t), cap*60), 600)
print("cap=%dmin, tgt=%.2fmin, average=%ds" % (cap, tgt/60, capped_average(expected_times(tgt), cap*60)))
# results:
# cap=11min, tgt=56.78min, average=600.0s
# cap=15min, tgt=17.16min, average=600.0s
# cap=16min, tgt=15.58min, average=600.0s
# cap=20min, tgt=12.55min, average=600.0s
# cap=25min, tgt=11.20min, average=600.0s
# cap=30min, tgt=10.63min, average=600.0s
# cap=45min, tgt=10.12min, average=600.0s
# cap=60min, tgt=10.03min, average=600.0sThat is, if you have a cap of 30 minutes, you need to be trying to have blocks every 10.63 minutes instead of every ten minutes because after applying the cap, you actual average will be reduced by that much. Effectively, this means the actual difficulty will generally be somewhat above the It seems to me like 30 minutes is a nice round figure that doesn't cause anything to get too weird; and I've used 16minutes as a lower limit, since below that, you're targetting an average block interval that's higher than your maximum acceptable block interval, so it's probably better to just not use |
… limit to 30min 51a08f4 signet/miner: reduce default interblock interval limit to 30min (Anthony Towns) Pull request description: Reduces the cap on the time between blocks from 60 minutes to 30 minutes, and makes it configurable. Top commit has no ACKs. Tree-SHA512: 7b880c50e47d055a2737c057fab190017748849d264c6c39dde465959a544d502221d12c6307d4de693f51badb4779b9c147e48775ede6ec6613e808067ab279
Reduces the cap on the time between blocks from 60 minutes to 30 minutes, and makes it configurable.