X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fpersistence.rs;fp=src%2Fpersistence.rs;h=ceeec9ded12d0b86433e2297a09c15849ead06e1;hb=7aaf4c6b6a6446506099516cb9b9edba4f14d0a4;hp=8fbf1664621cf80da643b79acbd0beb035ed9f45;hpb=a5b963c54a4eef59a0b2235e271e9481169db669;p=rapid-gossip-sync-server diff --git a/src/persistence.rs b/src/persistence.rs index 8fbf166..ceeec9d 100644 --- a/src/persistence.rs +++ b/src/persistence.rs @@ -109,8 +109,7 @@ impl GossipPersister { match &gossip_message { GossipMessage::ChannelAnnouncement(announcement) => { - let scid = announcement.contents.short_channel_id; - let scid_hex = hex_utils::hex_str(&scid.to_be_bytes()); + let scid = announcement.contents.short_channel_id as i64; // scid is 8 bytes // block height is the first three bytes // to obtain block height, shift scid right by 5 bytes (40 bits) @@ -126,7 +125,7 @@ impl GossipPersister { block_height, \ announcement_signed \ ) VALUES ($1, $2, $3) ON CONFLICT (short_channel_id) DO NOTHING", &[ - &scid_hex, + &scid, &block_height, &announcement_signed ]).await; @@ -135,7 +134,7 @@ impl GossipPersister { } } GossipMessage::ChannelUpdate(update) => { - let scid = update.contents.short_channel_id; + let scid = update.contents.short_channel_id as i64; let scid_hex = hex_utils::hex_str(&scid.to_be_bytes()); let timestamp = update.contents.timestamp as i64; @@ -173,10 +172,10 @@ impl GossipPersister { blob_signed \ ) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12) ON CONFLICT (composite_index) DO NOTHING", &[ &composite_index, - &scid_hex, + &scid, ×tamp, &channel_flags, - &direction, + &(direction == 1), &disable, &cltv_expiry_delta, &htlc_minimum_msat,