public MineBlockContext(ulong amountOfBlocksToMine, ulong chainHeight, ulong maxTries, ReserveScript reserveScript) { this.amountOfBlocksToMine = amountOfBlocksToMine; this.ChainHeight = chainHeight; this.CurrentHeight = chainHeight; this.MaxTries = maxTries; this.ReserveScript = reserveScript; }
/// <inheritdoc /> public List <uint256> GenerateBlocks(ReserveScript reserveScript, ulong amountOfBlocksToMine, ulong maxTries) { var context = new MineBlockContext(amountOfBlocksToMine, (ulong)this.chainIndexer.Height, maxTries, reserveScript); while (context.MiningCanContinue) { if (!ConsensusIsAtTip(context)) { continue; } if (!BuildBlock(context)) { continue; } if (!MineBlock(context)) { continue; } if (!ValidateMinedBlock(context)) { continue; } if (!ValidateAndConnectBlock(context)) { continue; } OnBlockMined(context); } return(context.Blocks); }