public bool ValidateSeal(BlockHeader header, bool force)
        {
            // genesis block is configured and assumed valid
            if (header.IsGenesis)
            {
                return(true);
            }

            if (!force && header.Number % _sealValidationInterval != 0)
            {
                return(true);
            }

            // the cache will return false both if the seal was invalid and if it has never been checked before
            if (_sealCache.Get(header.Hash))
            {
                return(true);
            }

            bool result = _ethash.Validate(header);

            _sealCache.Set(header.Hash, result);

            return(result);
        }
예제 #2
0
        public bool ValidateSeal(BlockHeader header)
        {
            if (header.Number % 64 != 0 || header.Number == 0)
            {
                return(true);
            }

            return(_ethash.Validate(header));
        }
예제 #3
0
        public bool ValidateSeal(BlockHeader header)
        {
            // TODO: all until we properly optimize ethash, still with sensible security measures (although there are many attack vectors for this particular node during sync)
            if (header.Number < 750000)
            {
                return(true);
            }

            if (header.Number < 6500000 && header.Number % 30000 != 0) // TODO: this numbers are here to secure mainnet only (current block and epoch length)
            {
                return(true);
            }

            return(_ethash.Validate(header));
        }
예제 #4
0
        public bool ValidateSeal(BlockHeader header)
        {
            if (header.Number % 1024 != 0 || header.Number == 0)
            {
                return(true);
            }

            lock (_sealCache)
            {
                if (_sealCache.Get(header.Hash))
                {
                    return(true);
                }
            }

            bool result = _ethash.Validate(header);

            lock (_sealCache)
            {
                _sealCache.Set(header.Hash, result);
            }

            return(result);
        }
예제 #5
0
 public bool Validate(BlockHeader header)
 {
     return(_ethash.Validate(header));
 }