From 69b1b9c56260e92cb7853abb1ed5853231f561ae Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 8 Nov 2016 21:06:48 +1030 Subject: [PATCH] db: store closing signature correctly. Running on my build machine, without valgrind, it managed to exchange closing sigs before restart, and spotted this bug. Fixes: #76 Signed-off-by: Rusty Russell --- daemon/db.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/daemon/db.c b/daemon/db.c index f4e1e1b95..2ae30044a 100644 --- a/daemon/db.c +++ b/daemon/db.c @@ -1775,10 +1775,10 @@ bool db_update_their_closing(struct peer *peer) assert(!peer->dstate->db->in_transaction); ok = db_exec(__func__, peer->dstate, - "UPDATE closing SET their_fee=%"PRIu64", their_sig=x'%s', sigs_in=%u WHERE peer=x'%s';", + "UPDATE closing SET their_fee=%"PRIu64", their_sig=%s, sigs_in=%u WHERE peer=x'%s';", peer->closing.their_fee, - tal_hexstr(ctx, peer->closing.their_sig, - tal_count(peer->closing.their_sig)), + sig_to_sql(ctx, peer->dstate->secpctx, + peer->closing.their_sig), peer->closing.sigs_in, peerid); tal_free(ctx);