From 6a062d852726d262d3768996213e0cb5390ac2f8 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 15 Mar 2016 17:09:42 +1030 Subject: [PATCH] daemon: check protobuf-c version, report failure. Signed-off-by: Rusty Russell --- daemon/cryptopkt.c | 5 +++-- daemon/lightningd.c | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/daemon/cryptopkt.c b/daemon/cryptopkt.c index d0870c711..ed2e0bfb9 100644 --- a/daemon/cryptopkt.c +++ b/daemon/cryptopkt.c @@ -184,9 +184,10 @@ static Pkt *decrypt_pkt(struct peer *peer, struct crypto_pkt *cpkt, prototal.allocator_data = tal(iod, char); ret = pkt__unpack(&prototal, data_len, cpkt->data); - if (!ret) + if (!ret) { + log_unusual(peer->log, "Packet failed to unpack!"); tal_free(prototal.allocator_data); - else + } else /* Make sure packet owns contents */ tal_steal(ret, prototal.allocator_data); return ret; diff --git a/daemon/lightningd.c b/daemon/lightningd.c index edd49e46f..800214be4 100644 --- a/daemon/lightningd.c +++ b/daemon/lightningd.c @@ -207,6 +207,10 @@ int main(int argc, char *argv[]) err_set_progname(argv[0]); opt_set_alloc(opt_allocfn, tal_reallocfn, tal_freefn); + if (!streq(protobuf_c_version(), PROTOBUF_C_VERSION)) + errx(1, "Compiled against protobuf %s, but have %s", + PROTOBUF_C_VERSION, protobuf_c_version()); + opt_register_noarg("--help|-h", opt_usage_and_exit, "\n" "A bitcoin lightning daemon.",