Esempio n. 1
0
        private BaselineMetadata LoadMetadata()
        {
            byte[]           serializedMetadata = _baselineDb[_metadataKey];
            BaselineMetadata metadata;

            if (serializedMetadata == null)
            {
                metadata = new BaselineMetadata();
            }
            else
            {
                RlpStream rlpStream = new RlpStream(serializedMetadata);
                metadata = new BaselineMetadata(rlpStream.DecodeArray(itemContext => itemContext.DecodeAddress()));
            }

            return(metadata);
        }
Esempio n. 2
0
        private BaselineMetadata LoadMetadata()
        {
            byte[]           serializedMetadata = _baselineDb[_metadataKey];
            BaselineMetadata metadata;

            if (serializedMetadata == null)
            {
                metadata = new BaselineMetadata();
            }
            else
            {
                RlpStream  rlpStream = new RlpStream(serializedMetadata);
                Address?[] addresses = rlpStream.DecodeArray(itemContext => itemContext.DecodeAddress());
                metadata = new BaselineMetadata(
                    addresses.Where(a => a != null).Select(a => a !).ToArray());
            }

            return(metadata);
        }
Esempio n. 3
0
        public BaselineModule(
            ITxPoolBridge txPoolBridge,
            ILogFinder logFinder,
            IBlockFinder blockFinder,
            IAbiEncoder abiEncoder,
            IFileSystem fileSystem,
            IDb baselineDb,
            ILogManager logManager)
        {
            _abiEncoder   = abiEncoder ?? throw new ArgumentNullException(nameof(abiEncoder));
            _fileSystem   = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem));
            _baselineDb   = baselineDb ?? throw new ArgumentNullException(nameof(baselineDb));
            _logger       = logManager?.GetClassLogger() ?? throw new ArgumentNullException(nameof(logManager));
            _txPoolBridge = txPoolBridge ?? throw new ArgumentNullException(nameof(txPoolBridge));
            _logFinder    = logFinder ?? throw new ArgumentNullException(nameof(logFinder));
            _blockFinder  = blockFinder ?? throw new ArgumentNullException(nameof(blockFinder));

            _metadata = LoadMetadata();
            InitTrees();
        }