Minor cleanups: things found while debugging the database code.

1. Fix #ifdef DEBUG code in signature.c so it compiles.
2. Don't set peer->closing.our_script in queue_pkt_close_shutdown: it's
   assigned in caller already.
3. Wrap setting of htlc's rval in set_htlc_rval() function.
4. Log where we were when unexpected packet comes in.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2016-08-18 14:25:13 +09:30
parent 0bb183e028
commit be38d3f507
5 changed files with 30 additions and 27 deletions

View File

@@ -239,14 +239,9 @@ void queue_pkt_err(struct peer *peer, Pkt *err)
void queue_pkt_close_shutdown(struct peer *peer)
{
u8 *redeemscript;
CloseShutdown *c = tal(peer, CloseShutdown);
close_shutdown__init(c);
redeemscript = bitcoin_redeem_single(c, peer->dstate->secpctx,
&peer->local.finalkey);
peer->closing.our_script = scriptpubkey_p2sh(peer, redeemscript);
c->scriptpubkey.data = tal_dup_arr(c, u8,
peer->closing.our_script,
tal_count(peer->closing.our_script),
@@ -473,7 +468,7 @@ Pkt *accept_pkt_htlc_fulfill(struct peer *peer, const Pkt *pkt, struct htlc **h,
*was_already_fulfilled = true;
} else {
*was_already_fulfilled = false;
(*h)->r = tal_dup(*h, struct rval, &r);
set_htlc_rval(peer, *h, &r);
}
return NULL;
}