Commit de4c56e
authored
Refactor
This PR improves the readability of the modified `get_ancestor` in
Gloas.
`get_ancestor` in Phase0 does only one job: find and return the root of
a block that is `block.slot <= slot`.
`get_ancestor` in Gloas is modified to do two jobs: 1) return `root` and
`PAYLOAD_STATUS_PENDING` if the block with the given `root` has
`block.slot <= slot`, otherwise 2) find and return the root of a block
and its payload status that is `block.slot <= slot`.
The first condition cannot be met during a recursion and hence it
doesn't need to be part of it. Thus, I think using iteration here makes
what this function does a bit clearer.get_ancestor in Gloas (#4802)1 parent ef27ce4 commit de4c56e
1 file changed
+8
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
254 | 255 | | |
255 | 256 | | |
256 | 257 | | |
| |||
0 commit comments