Function simulatePreimages

Externalize pre-images for all validators (minus skipped ones) at height

void simulatePreimages (
  Ledger ledger,
  in const(Height) height,
  uint[] skip_indexes = null
) @safe;

When generating blocks in unittests, a common need is to have pre-images externalized so that the signatures match.

This can be done by this function, which will call addPreimage for each currently-enrolled validator with a value suitable for height height.

Parameters

NameDescription
ledger The Ledger to call addPreimage on
height The desired height for the pre-images
skip_indexes If not empty (the default), validators that are at the provided index(es) will not have their pre-images added. The index can be retrieved from getValidators. This can be used to test slashing.