Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="HeaderValidationContext" /> class.
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="block">The block.</param>
        /// <param name="isInInitialBlockDownloadState">if set to <c>true</c> node is currently in InitialBlockDownload state.</param>
        /// <param name="chainState">State of the chain.</param>
        public BlockValidationContext(ILogger logger,
                                      Protocol.Types.Block block,
                                      bool isInInitialBlockDownloadState,
                                      IChainState chainState) : base(logger, isInInitialBlockDownloadState, chainState)
        {
            Block = block;

            KnownBlock = null; //TODO or remove this property?
        }
Пример #2
0
        private int GetBlockSize(Protocol.Types.Block block)
        {
            var buffer = new PooledByteBufferWriter(block.Transactions !.Length * 256);

            return(_blockSerializer.Serialize(
                       block,
                       KnownVersion.CurrentVersion,
                       new PooledByteBufferWriter(block.Transactions !.Length * 256),
                       new ProtocolTypeSerializerOptions((SerializerOptions.SERIALIZE_WITNESS, false))
                       ));
        }
Пример #3
0
 public BlockToValidate(Protocol.Types.Block block, IPeerContext?peer)
 {
     Block = block;
     Peer  = peer;
 }
Пример #4
0
 public IBlockValidationContext Create(Protocol.Types.Block block)
 {
     return(new BlockValidationContext(_logger, block, _initialBlockDownloadState.IsDownloadingBlocks(), _chainState));
 }