Commit 4052ab92 authored by George Knee's avatar George Knee Committed by GitHub

ensure we increase the pending_blocks metric when a channel times out (#12810)

In this situation, the blocks get another chance to be put into a channel, when the metric will be decremented. This leads to inaccurate (even negative) metrics.
parent b20ca5db
......@@ -115,11 +115,11 @@ func (s *channelManager) TxConfirmed(_id txID, inclusionBlock eth.BlockID) {
id := _id.String()
if channel, ok := s.txChannels[id]; ok {
delete(s.txChannels, id)
done, blocks := channel.TxConfirmed(id, inclusionBlock)
done, blocksToRequeue := channel.TxConfirmed(id, inclusionBlock)
if done {
s.removePendingChannel(channel)
if len(blocks) > 0 {
s.blocks.Prepend(blocks...)
for _, b := range blocksToRequeue {
s.blocks.Prepend(b)
s.metr.RecordL2BlockInPendingQueue(b)
}
}
} else {
......@@ -504,9 +504,8 @@ func (s *channelManager) Requeue(newCfg ChannelConfig) {
}
// We put the blocks back at the front of the queue:
s.blocks.Prepend(blocksToRequeue...)
for _, b := range blocksToRequeue {
s.blocks.Prepend(b)
s.metr.RecordL2BlockInPendingQueue(b)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment