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:
parent
83786fbd80
commit
484cf0220c
|
|
@ -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";
|
||||
|
|
|
|||
Loading…
Reference in New Issue