Esempio n. 1
0
        public void Test_real_block(string blockRlp)
        {
            Block block       = Rlp.Decode <Block>(new Rlp(Bytes.FromHexString(blockRlp)));
            bool  validHeader = _sealValidator.ValidateParams(_blockTree.FindHeader(block.ParentHash, BlockTreeLookupOptions.None), block.Header);
            bool  validSeal   = _sealValidator.ValidateSeal(block.Header, true);

            Assert.True(validHeader);
            Assert.True(validSeal);
        }
        public async Task Can_sign_block()
        {
            Block block6 = CreateBlock(2, 6, _lastBlock);
            Block signed = await _clique.SealBlock(block6, CancellationToken.None);

            bool validHeader = _sealValidator.ValidateParams(_blockTree.FindHeader(signed.ParentHash, BlockTreeLookupOptions.None), signed.Header);
            bool validSeal   = _sealValidator.ValidateSeal(signed.Header);

            Assert.True(validHeader);
            Assert.True(validSeal);
        }
Esempio n. 3
0
        public void Test_no_signer_data_at_epoch_fails(string blockRlp)
        {
            CliqueConfig config = new() { Epoch = 4 };

            _clique        = new CliqueSealer(NullSigner.Instance, config, _snapshotManager, LimboLogs.Instance);
            _sealValidator = new CliqueSealValidator(config, _snapshotManager, LimboLogs.Instance);
            Block block       = Rlp.Decode <Block>(new Rlp(Bytes.FromHexString(blockRlp)));
            bool  validHeader = _sealValidator.ValidateParams(_blockTree.FindHeader(block.ParentHash, BlockTreeLookupOptions.None), block.Header);
            bool  validSeal   = _sealValidator.ValidateSeal(block.Header, true);

            Assert.False(validHeader);
            Assert.True(validSeal);
        }