detailed tracing in block_pool.getBlockRange
This commit is contained in:
parent
4c2ded25a6
commit
258f6f6334
|
@ -347,13 +347,20 @@ func getBlockRange*(pool: BlockPool, headBlock: Eth2Digest,
|
||||||
result = output.len
|
result = output.len
|
||||||
|
|
||||||
var b = pool.getRef(headBlock)
|
var b = pool.getRef(headBlock)
|
||||||
if b == nil or b.slot < startSlot:
|
if b == nil:
|
||||||
|
trace "head block not found"
|
||||||
|
return
|
||||||
|
|
||||||
|
if b.slot < startSlot:
|
||||||
|
trace "head block is older than startSlot", headBlockSlot = b.slot, startSlot
|
||||||
return
|
return
|
||||||
|
|
||||||
template skip(n: int) =
|
template skip(n: int) =
|
||||||
for i in 0 ..< n:
|
for i in 0 ..< n:
|
||||||
|
if b.parent == nil:
|
||||||
|
trace "stopping at parentless block", slot = b.slot
|
||||||
|
return
|
||||||
b = b.parent
|
b = b.parent
|
||||||
if b == nil: return
|
|
||||||
|
|
||||||
# We must compute the last block that is eligible for inclusion
|
# We must compute the last block that is eligible for inclusion
|
||||||
# in the results. This will be a block with a slot number that's
|
# in the results. This will be a block with a slot number that's
|
||||||
|
@ -375,6 +382,7 @@ func getBlockRange*(pool: BlockPool, headBlock: Eth2Digest,
|
||||||
while b != nil and result > 0:
|
while b != nil and result > 0:
|
||||||
dec result
|
dec result
|
||||||
output[result] = b
|
output[result] = b
|
||||||
|
trace "getBlockRange result", position = result, blockSlot = b.slot
|
||||||
skip skipStep
|
skip skipStep
|
||||||
|
|
||||||
proc get*(pool: BlockPool, blck: BlockRef): BlockData =
|
proc get*(pool: BlockPool, blck: BlockRef): BlockData =
|
||||||
|
|
Loading…
Reference in New Issue