@@ -95,7 +95,7 @@ pub(super) async fn fetch_channel_announcements<L: Deref>(delta_set: &mut DeltaS
95
95
96
96
log_info ! ( logger, "Obtaining corresponding database entries" ) ;
97
97
// get all the channel announcements that are currently in the network graph
98
- let announcement_rows = client. query_raw ( "SELECT announcement_signed, seen FROM channel_announcements WHERE short_channel_id = any($1) ORDER BY short_channel_id ASC" , [ & channel_ids] ) . await . unwrap ( ) ;
98
+ let announcement_rows = client. query_raw ( "SELECT announcement_signed, CAST(EXTRACT('epoch' from seen) AS BIGINT) AS seen FROM channel_announcements WHERE short_channel_id = any($1) ORDER BY short_channel_id ASC" , [ & channel_ids] ) . await . unwrap ( ) ;
99
99
let mut pinned_rows = Box :: pin ( announcement_rows) ;
100
100
101
101
let mut announcement_count = 0 ;
@@ -106,8 +106,7 @@ pub(super) async fn fetch_channel_announcements<L: Deref>(delta_set: &mut DeltaS
106
106
let unsigned_announcement = ChannelAnnouncement :: read ( & mut readable) . unwrap ( ) . contents ;
107
107
108
108
let scid = unsigned_announcement. short_channel_id ;
109
- let current_seen_timestamp_object: SystemTime = current_announcement_row. get ( "seen" ) ;
110
- let current_seen_timestamp: u32 = current_seen_timestamp_object. duration_since ( SystemTime :: UNIX_EPOCH ) . unwrap ( ) . as_secs ( ) as u32 ;
109
+ let current_seen_timestamp = current_announcement_row. get :: < _ , i64 > ( "seen" ) as u32 ;
111
110
112
111
let current_channel_delta = delta_set. entry ( scid) . or_insert ( ChannelDelta :: default ( ) ) ;
113
112
( * current_channel_delta) . announcement = Some ( AnnouncementDelta {
@@ -133,7 +132,7 @@ pub(super) async fn fetch_channel_announcements<L: Deref>(delta_set: &mut DeltaS
133
132
let params: [ & ( dyn tokio_postgres:: types:: ToSql + Sync ) ; 2 ] =
134
133
[ & channel_ids, & last_sync_timestamp_float] ;
135
134
let newer_oldest_directional_updates = client. query_raw ( "
136
- SELECT * FROM (
135
+ SELECT short_channel_id, CAST(EXTRACT('epoch' from distinct_chans.seen) AS BIGINT) AS seen FROM (
137
136
SELECT DISTINCT ON (short_channel_id) *
138
137
FROM (
139
138
SELECT DISTINCT ON (short_channel_id, direction) short_channel_id, seen
@@ -152,8 +151,7 @@ pub(super) async fn fetch_channel_announcements<L: Deref>(delta_set: &mut DeltaS
152
151
let current_row = row_res. unwrap ( ) ;
153
152
154
153
let scid: i64 = current_row. get ( "short_channel_id" ) ;
155
- let current_seen_timestamp_object: SystemTime = current_row. get ( "seen" ) ;
156
- let current_seen_timestamp: u32 = current_seen_timestamp_object. duration_since ( SystemTime :: UNIX_EPOCH ) . unwrap ( ) . as_secs ( ) as u32 ;
154
+ let current_seen_timestamp = current_row. get :: < _ , i64 > ( "seen" ) as u32 ;
157
155
158
156
// the newer of the two oldest seen directional updates came after last sync timestamp
159
157
let current_channel_delta = delta_set. entry ( scid as u64 ) . or_insert ( ChannelDelta :: default ( ) ) ;
@@ -287,7 +285,7 @@ pub(super) async fn fetch_channel_updates<L: Deref>(delta_set: &mut DeltaSet, cl
287
285
// have been omitted)
288
286
289
287
let intermediate_updates = client. query_raw ( "
290
- SELECT id, direction, blob_signed, seen
288
+ SELECT id, direction, blob_signed, CAST(EXTRACT('epoch' from seen) AS BIGINT) AS seen
291
289
FROM channel_updates
292
290
WHERE seen >= TO_TIMESTAMP($1)
293
291
" , [ last_sync_timestamp_float] ) . await . unwrap ( ) ;
@@ -308,8 +306,7 @@ pub(super) async fn fetch_channel_updates<L: Deref>(delta_set: &mut DeltaSet, cl
308
306
intermediate_update_count += 1 ;
309
307
310
308
let direction: bool = intermediate_update. get ( "direction" ) ;
311
- let current_seen_timestamp_object: SystemTime = intermediate_update. get ( "seen" ) ;
312
- let current_seen_timestamp: u32 = current_seen_timestamp_object. duration_since ( SystemTime :: UNIX_EPOCH ) . unwrap ( ) . as_secs ( ) as u32 ;
309
+ let current_seen_timestamp = intermediate_update. get :: < _ , i64 > ( "seen" ) as u32 ;
313
310
let blob: Vec < u8 > = intermediate_update. get ( "blob_signed" ) ;
314
311
let mut readable = Cursor :: new ( blob) ;
315
312
let unsigned_channel_update = ChannelUpdate :: read ( & mut readable) . unwrap ( ) . contents ;
0 commit comments