You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
letmut scids = Box::pin(client.query_raw("SELECT DISTINCT ON (short_channel_id) short_channel_id FROM channel_announcements WHERE funding_amount_sats IS NULL;",&[0i64][1..]).await.unwrap());
334
+
let sem = Arc::new(Semaphore::new(16));
335
+
whileletSome(scid_res) = scids.next().await{
336
+
let scid:i64 = scid_res.unwrap().get(0);
337
+
let permit = Arc::clone(&sem).acquire_owned().await.unwrap();
338
+
let logger = logger.clone();
339
+
tokio::spawn(asyncmove{
340
+
let rest_client = Arc::new(RestClient::new(bitcoin_rest_endpoint()).unwrap());
341
+
let txo = ChainVerifier::retrieve_txo(rest_client, scid asu64, logger).await
342
+
.expect("We shouldn't have accepted a channel announce with a bad TXO");
343
+
let client = crate::connect_to_db().await;
344
+
client.execute("UPDATE channel_announcements SET funding_amount_sats = $1 WHERE short_channel_id = $2",&[&(txo.value.to_sat()asi64),&scid]).await.unwrap();
345
+
std::mem::drop(permit);
346
+
});
347
+
}
348
+
let _all_updates_complete = sem.acquire_many(16).await.unwrap();
349
+
client.execute("ALTER TABLE channel_announcements ALTER funding_amount_sats SET NOT NULL",&[]).await.unwrap();
350
+
client.execute("UPDATE config SET db_schema = 15 WHERE id = 1",&[]).await.unwrap();
351
+
});
319
352
}
320
353
if schema <= 1 || schema > SCHEMA_VERSION{
321
354
panic!("Unknown schema in db: {}, we support up to {}", schema,SCHEMA_VERSION);
0 commit comments