Skip to content

[bug]: HighestChanID should exclude zero-conf alias SCIDs #7371

Open
@Crypt-iQ

Description

@Crypt-iQ

The HighestChanID function is used to determine the highest SCID that we know of when syncing gossip with another peer. If genChanRangeQuery calls it outside of a historical query and a zero-conf SCID exists in the database, it should cause an underflow when the alias SCID height is subtracted from our best block. This would then get cast to a uint32 and would mean we send a very high number_of_blocks value to the peer.

lnd/discovery/syncer.go

Lines 925 to 932 in d9febbb

startHeight = uint32(newestChan.BlockHeight - chanRangeQueryBuffer)
}
// Determine the number of blocks to request based on our best height.
// We'll take into account any potential underflows and explicitly set
// numBlocks to its minimum value of 1 if so.
bestHeight := g.cfg.bestHeight()
numBlocks := bestHeight - startHeight

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2should be fixed if one has timebugUnintended code behaviourgossipzero conf

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions