graph/db: fetch policy version in cache paginated query

The ListChannelsWithPoliciesForCachePaginated query was missing the
policy version column, causing extractChannelPolicies to hardcode
lnwire.GossipVersion1 for that row type. Add cp1.version and
cp2.version to the query and use the fetched values instead.
This commit is contained in:
Elle Mouton committed 2026-02-20 09:28:13 +02:00
1 parent acb3240d3d
commit 7c7a0ae13d
3 files changed
+10 -2

No files matched your search

+2 -2
View File
@@ -5082,7 +5082,7 @@ func extractChannelPolicies(row any) (*sqlc.GraphChannelPolicy,
case sqlc.ListChannelsWithPoliciesForCachePaginatedRow:
if r.Policy1Timelock.Valid {
policy1 = &sqlc.GraphChannelPolicy{
Version: int16(lnwire.GossipVersion1),
Version: r.Policy1Version.Int16,
Timelock: r.Policy1Timelock.Int32,
FeePpm: r.Policy1FeePpm.Int64,
BaseFeeMsat: r.Policy1BaseFeeMsat.Int64,
@@ -5099,7 +5099,7 @@ func extractChannelPolicies(row any) (*sqlc.GraphChannelPolicy,
}
if r.Policy2Timelock.Valid {
policy2 = &sqlc.GraphChannelPolicy{
Version: int16(lnwire.GossipVersion1),
Version: r.Policy2Version.Int16,
Timelock: r.Policy2Timelock.Int32,
FeePpm: r.Policy2FeePpm.Int64,
BaseFeeMsat: r.Policy2BaseFeeMsat.Int64,