Пример #1
0
        public async Task <(NBitcoin.Block, string)> MineNextBlockAsync(IEnumerable <NBitcoin.Transaction> transactions,
                                                                        bool throwOnError = true, string parentBlockHash = null)
        {
            if (string.IsNullOrEmpty(parentBlockHash))
            {
                parentBlockHash = await rpcClient0.GetBestBlockHashAsync();
            }

            var parentBlockBytes = await rpcClient0.GetBlockAsBytesAsync(parentBlockHash);

            var parentBlock       = NBitcoin.Block.Load(parentBlockBytes, Network.RegTest);
            var parentBlockHeight = (await rpcClient0.GetBlockHeaderAsync(parentBlockHash)).Height;

            return(await MineNextBlockAsync(transactions, throwOnError, parentBlock, parentBlockHeight));
        }