Skip to content

Commit

Permalink
daemon: check protobuf-c version, report failure.
Browse files Browse the repository at this point in the history
Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Mar 15, 2016
1 parent 6410b0a commit 6a062d8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions daemon/cryptopkt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions daemon/lightningd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down

0 comments on commit 6a062d8

Please sign in to comment.