From 65be414d1bff066985289f4f60b551b985ae45ab Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Fri, 25 Sep 2015 11:51:19 +0930 Subject: [PATCH] test_state_coverage: unset outputs as we use them. Otherwise hashing might not spot duplicate states. Doesn't seem to make much difference in timing in practice though. Signed-off-by: Rusty Russell --- test/test_state_coverage.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/test_state_coverage.c b/test/test_state_coverage.c index 96ea4a455..865c0413e 100644 --- a/test/test_state_coverage.c +++ b/test/test_state_coverage.c @@ -963,6 +963,11 @@ static struct trail *run_peer(const struct state_data *sdata, static void update_core(struct core_state *core, const struct state_data *sdata) { + size_t i; + + for (i = core->num_outputs; i < ARRAY_SIZE(core->outputs); i++) + assert(core->outputs[i] == 0); + core->has_current_htlc = sdata->current_htlc.htlc.id != -1; core->capped_htlcs_to_us = cap(sdata->num_htlcs_to_us); core->capped_htlcs_to_them = cap(sdata->num_htlcs_to_them); @@ -1969,6 +1974,8 @@ static struct trail *run_peer(const struct state_data *sdata, memmove(peer.pkt_data, peer.pkt_data + 1, sizeof(peer.pkt_data)-sizeof(peer.pkt_data[0])); peer.core.num_outputs--; + /* Reset so that hashing doesn't get confused. */ + peer.core.outputs[peer.core.num_outputs] = 0; return try_input(©, i, idata, normalpath, errorpath, depth, hist); }