Skip to content

Commit

Permalink
Serialize socket addresses as blobs.
Browse files Browse the repository at this point in the history
  • Loading branch information
arik-so committed May 14, 2024
1 parent e6558fe commit 596baea
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ pub(crate) fn db_node_announcement_table_creation_query() -> &'static str {
id SERIAL PRIMARY KEY,
public_key varchar(66) NOT NULL,
features text NOT NULL,
socket_addresses text,
socket_addresses BYTEA,
timestamp bigint NOT NULL,
announcement_signed BYTEA,
seen timestamp NOT NULL DEFAULT NOW()
Expand Down
5 changes: 2 additions & 3 deletions src/persistence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ impl<L: Deref> GossipPersister<L> where L::Target: Logger {

let mut serialized_addresses = Vec::new();
announcement.contents.addresses.write(&mut serialized_addresses).unwrap();
let socket_addresses_hex = serialized_addresses.to_lower_hex_string();

let _task = self.tokio_runtime.spawn(async move {
if cfg!(test) && seen_override.is_some() {
Expand All @@ -159,7 +158,7 @@ impl<L: Deref> GossipPersister<L> where L::Target: Logger {
) VALUES ($1, $2, $3, $4, $5, TO_TIMESTAMP($6))", &[
&public_key_hex,
&features,
&socket_addresses_hex,
&serialized_addresses,
&timestamp,
&announcement_signed,
&(seen_override.unwrap() as f64)
Expand All @@ -175,7 +174,7 @@ impl<L: Deref> GossipPersister<L> where L::Target: Logger {
) VALUES ($1, $2, $3, $4, $5)", &[
&public_key_hex,
&features,
&socket_addresses_hex,
&serialized_addresses,
&timestamp,
&announcement_signed,
])).await.unwrap().unwrap();
Expand Down

0 comments on commit 596baea

Please sign in to comment.