mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-19 05:44:12 +01:00
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 <rusty@rustcorp.com.au>
This commit is contained in:
parent
2f1414362c
commit
65be414d1b
@ -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)
|
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->has_current_htlc = sdata->current_htlc.htlc.id != -1;
|
||||||
core->capped_htlcs_to_us = cap(sdata->num_htlcs_to_us);
|
core->capped_htlcs_to_us = cap(sdata->num_htlcs_to_us);
|
||||||
core->capped_htlcs_to_them = cap(sdata->num_htlcs_to_them);
|
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,
|
memmove(peer.pkt_data, peer.pkt_data + 1,
|
||||||
sizeof(peer.pkt_data)-sizeof(peer.pkt_data[0]));
|
sizeof(peer.pkt_data)-sizeof(peer.pkt_data[0]));
|
||||||
peer.core.num_outputs--;
|
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,
|
return try_input(©, i, idata, normalpath, errorpath,
|
||||||
depth, hist);
|
depth, hist);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user