Commit 1fb5ec5
authored
refactor(generator): behaviour fixes for new_payload_job and best_payload (#480)
- `best_payload`: was `unimplemented!()` and would crash the builder if
ever called. Now returns the latest payload published to the
internal `watch` channel, or `PayloadBuilderError::MissingPayload`
when nothing has been built yet.
- FCU arrival-delay metric: use `checked_sub` to avoid an underflow
panic when `block_time` exceeds the payload timestamp (possible in
tests with tiny timestamps), and switch to
`Duration::as_secs_f64() * 1000.0` instead of casting through
`u128 -> i64 -> f64`.
- `new_payload_job`: collapse the cancel-old / store-new sequence
into a single critical section. Closes a small window where a
concurrent observer could see the old cancellation fired but the
new one not yet stored. Also runs the parent-header lookup before
cancelling the previous job, so a malformed FCU does not abort
in-progress work.
- `resolve_kind`: drop the `payload_kind` field from the info log,
since only one kind is in use.1 parent 667a564 commit 1fb5ec5
1 file changed
Lines changed: 26 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
149 | 149 | | |
150 | 150 | | |
151 | 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 | | - | |
176 | | - | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
177 | 159 | | |
| 160 | + | |
178 | 161 | | |
179 | 162 | | |
180 | 163 | | |
| |||
187 | 170 | | |
188 | 171 | | |
189 | 172 | | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
190 | 184 | | |
191 | 185 | | |
192 | 186 | | |
| |||
204 | 198 | | |
205 | 199 | | |
206 | 200 | | |
207 | | - | |
| 201 | + | |
208 | 202 | | |
209 | 203 | | |
210 | 204 | | |
| |||
278 | 272 | | |
279 | 273 | | |
280 | 274 | | |
281 | | - | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
282 | 279 | | |
283 | 280 | | |
284 | 281 | | |
| |||
287 | 284 | | |
288 | 285 | | |
289 | 286 | | |
290 | | - | |
| 287 | + | |
291 | 288 | | |
292 | | - | |
| 289 | + | |
293 | 290 | | |
294 | 291 | | |
295 | 292 | | |
| |||
0 commit comments