Commit f8a1263
committed
fix(bch): seed cold-start share-target floor on work-gen path, not share-create
The empty-sharechain cold-start seed for share_bits_ lived in
build_connection_coinbase (the share-CREATE path), but that path only
runs after core::StratumServer clears its is_pool_share gate, which is
derived from pool_difficulty, itself derived from share_bits_. On an
empty chain share_bits_==0 => pool_difficulty==0 => the gate never fires
=> no share is created => share_bits_ never advances: a deadlock the
share-create seed cannot break because it sits behind the gate it opens.
Relocate a floor-seed into cached_template() on the WORK-GEN path, which
runs on every work poll independent of share creation. Seed both atomics
to target_to_bits_upper_bound(PoolConfig::max_target()) -- the exact floor
compute_share_target emits for max_bits on the genesis branch. Idempotent
(fires only while unseeded). Verified on .198 regtest: pool_difficulty
0 -> 1 at cold start, is_pool_share gate now live from first work poll.1 parent 8c82dbf commit f8a1263
1 file changed
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
222 | 223 | | |
223 | 224 | | |
224 | 225 | | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
225 | 246 | | |
226 | 247 | | |
227 | 248 | | |
| |||
0 commit comments