| 16 | #define GOSSIP_STORE_ZOMBIE_BIT_V13 0x1000U |
| 17 | |
| 18 | static bool upgrade_field(u8 oldversion, |
| 19 | be16 *hdr_flags, |
| 20 | u8 **msg) |
| 21 | { |
| 22 | int type = fromwire_peektype(*msg); |
| 23 | |
| 24 | switch (oldversion) { |
| 25 | case 10: |
| 26 | /* Remove old channel_update with no htlc_maximum_msat */ |
| 27 | if (type == WIRE_CHANNEL_UPDATE |
| 28 | && tal_bytelen(*msg) == 130) { |
| 29 | *msg = tal_free(*msg); |
| 30 | return true; |
| 31 | } |
| 32 | /* fall thru */ |
| 33 | case 11: |
| 34 | case 12: |
| 35 | /* Remove private entries */ |
| 36 | if (type == WIRE_GOSSIP_STORE_PRIVATE_CHANNEL_OBS) { |
| 37 | *msg = tal_free(*msg); |
| 38 | return true; |
| 39 | } else if (type == WIRE_GOSSIP_STORE_PRIVATE_UPDATE_OBS) { |
| 40 | *msg = tal_free(*msg); |
| 41 | return true; |
| 42 | } |
| 43 | /* fall thru */ |
| 44 | case 13: |
| 45 | /* Discard any zombies */ |
| 46 | if (be16_to_cpu(*hdr_flags) & GOSSIP_STORE_ZOMBIE_BIT_V13) { |
| 47 | *msg = tal_free(*msg); |
| 48 | return true; |
| 49 | } |
| 50 | case 14: |
| 51 | /* Add completed field */ |
| 52 | *hdr_flags |= CPU_TO_BE16(GOSSIP_STORE_COMPLETED_BIT); |
| 53 | /* fall thru */ |
| 54 | case 15: |
| 55 | /* Noop */ |
| 56 | return true; |
| 57 | } |
| 58 | |
| 59 | return false; |
| 60 | } |
| 61 | |
| 62 | int main(int argc, char *argv[]) |
| 63 | { |
no test coverage detected