mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-11-21 10:30:41 +08:00
node: Don't panic if we can't decode announcements
Bubble up the error instead. Also, as part of the migration, delete existing announcements that won't decode properly.
This commit is contained in:
@@ -363,15 +363,15 @@ mod parse {
|
||||
let gt = row.read::<GossipType, _>("type");
|
||||
let message = match gt {
|
||||
GossipType::Refs => {
|
||||
let ann = row.read::<RefsAnnouncement, _>("message");
|
||||
let ann = row.try_read::<RefsAnnouncement, _>("message")?;
|
||||
AnnouncementMessage::Refs(ann)
|
||||
}
|
||||
GossipType::Inventory => {
|
||||
let ann = row.read::<InventoryAnnouncement, _>("message");
|
||||
let ann = row.try_read::<InventoryAnnouncement, _>("message")?;
|
||||
AnnouncementMessage::Inventory(ann)
|
||||
}
|
||||
GossipType::Node => {
|
||||
let ann = row.read::<NodeAnnouncement, _>("message");
|
||||
let ann = row.try_read::<NodeAnnouncement, _>("message")?;
|
||||
AnnouncementMessage::Node(ann)
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
-- Add the version and user-agent columns.
|
||||
alter table "nodes" add column "version" integer not null default 1;
|
||||
alter table "nodes" add column "agent" text not null default "/radicle/";
|
||||
-- Delete all cached announcements, since they no longer match our format.
|
||||
delete from "announcements";
|
||||
|
||||
Reference in New Issue
Block a user