Пример #1
0
        public T ResolveVersion(BlockHeader blockHeader)
        {
            this.BlockActivationCheck(blockHeader);

            if (!_versionsCache.TryGet(blockHeader.Hash, out var versionNumber))
            {
                versionNumber = _versionSelectorContract.ContractVersion(blockHeader);
                _versionsCache.Set(blockHeader.Hash, versionNumber);
            }

            return(ResolveVersion(versionNumber));
        }
Пример #2
0
        public T?ResolveVersion(BlockHeader blockHeader)
        {
            this.BlockActivationCheck(blockHeader);

            if (!_versionsCache.TryGet(blockHeader.Hash, out var versionNumber))
            {
                try
                {
                    versionNumber = _versionSelectorContract.ContractVersion(blockHeader);
                    _versionsCache.Set(blockHeader.Hash, versionNumber);
                }
                catch (AbiException ex)
                {
                    if (_logger.IsWarn)
                    {
                        _logger.Warn($"The contract version set to 1: {ex}");
                    }
                    versionNumber = UInt256.One;
                    _versionsCache.Set(blockHeader.Hash, versionNumber);
                }
            }

            return(ResolveVersion(versionNumber));
        }