private Network InitTest() { Network network = new BitcoinTest(); network.MoneyUnits = GetMoneyUnitsMainAndTest(); return(network); }
public void BitcoinConsensusRulesRegistrationTest() { Network network = new BitcoinTest(); new FullNodeBuilderConsensusExtension.PowConsensusRulesRegistration().RegisterRules(network.Consensus); List <IHeaderValidationConsensusRule> headerValidationRules = network.Consensus.HeaderValidationRules; headerValidationRules.Count.Should().Be(4); headerValidationRules[0].Should().BeOfType <HeaderTimeChecksRule>(); headerValidationRules[1].Should().BeOfType <CheckDifficultyPowRule>(); headerValidationRules[2].Should().BeOfType <BitcoinActivationRule>(); headerValidationRules[3].Should().BeOfType <BitcoinHeaderVersionRule>(); List <IIntegrityValidationConsensusRule> integrityValidationRules = network.Consensus.IntegrityValidationRules; integrityValidationRules.Count.Should().Be(1); integrityValidationRules[0].Should().BeOfType <BlockMerkleRootRule>(); List <IPartialValidationConsensusRule> partialValidationRules = network.Consensus.PartialValidationRules; partialValidationRules.Count.Should().Be(8); partialValidationRules[0].Should().BeOfType <SetActivationDeploymentsPartialValidationRule>(); partialValidationRules[1].Should().BeOfType <TransactionLocktimeActivationRule>(); partialValidationRules[2].Should().BeOfType <CoinbaseHeightActivationRule>(); partialValidationRules[3].Should().BeOfType <WitnessCommitmentsRule>(); partialValidationRules[4].Should().BeOfType <BlockSizeRule>(); partialValidationRules[5].Should().BeOfType <EnsureCoinbaseRule>(); partialValidationRules[6].Should().BeOfType <CheckPowTransactionRule>(); partialValidationRules[7].Should().BeOfType <CheckSigOpsRule>(); List <IFullValidationConsensusRule> fullValidationRules = network.Consensus.FullValidationRules; fullValidationRules.Count.Should().Be(5); fullValidationRules[0].Should().BeOfType <SetActivationDeploymentsFullValidationRule>(); fullValidationRules[1].Should().BeOfType <LoadCoinviewRule>(); fullValidationRules[2].Should().BeOfType <TransactionDuplicationActivationRule>(); fullValidationRules[3].Should().BeOfType <PowCoinviewRule>(); fullValidationRules[4].Should().BeOfType <SaveCoinviewRule>(); }
public void BitcoinConsensusRulesRegistrationTest() { Network network = new BitcoinTest(); //new FullNodeBuilderConsensusExtension.PowConsensusRulesRegistration().RegisterRules(network.Consensus); List <Type> headerValidationRules = network.Consensus.ConsensusRules.HeaderValidationRules; headerValidationRules.Count.Should().Be(4); headerValidationRules[0].FullName.Should().Be(typeof(HeaderTimeChecksRule).FullName); headerValidationRules[1].FullName.Should().Be(typeof(CheckDifficultyPowRule).FullName); headerValidationRules[2].FullName.Should().Be(typeof(BitcoinActivationRule).FullName); headerValidationRules[3].FullName.Should().Be(typeof(BitcoinHeaderVersionRule).FullName); List <Type> integrityValidationRules = network.Consensus.ConsensusRules.IntegrityValidationRules; integrityValidationRules.Count.Should().Be(1); integrityValidationRules[0].FullName.Should().Be(typeof(BlockMerkleRootRule).FullName); List <Type> partialValidationRules = network.Consensus.ConsensusRules.PartialValidationRules; partialValidationRules.Count.Should().Be(8); partialValidationRules[0].FullName.Should().Be(typeof(SetActivationDeploymentsPartialValidationRule).FullName); partialValidationRules[1].FullName.Should().Be(typeof(TransactionLocktimeActivationRule).FullName); partialValidationRules[2].FullName.Should().Be(typeof(CoinbaseHeightActivationRule).FullName); partialValidationRules[3].FullName.Should().Be(typeof(WitnessCommitmentsRule).FullName); partialValidationRules[4].FullName.Should().Be(typeof(BlockSizeRule).FullName); partialValidationRules[5].FullName.Should().Be(typeof(EnsureCoinbaseRule).FullName); partialValidationRules[6].FullName.Should().Be(typeof(CheckPowTransactionRule).FullName); partialValidationRules[7].FullName.Should().Be(typeof(CheckSigOpsRule).FullName); List <Type> fullValidationRules = network.Consensus.ConsensusRules.FullValidationRules; fullValidationRules.Count.Should().Be(6); fullValidationRules[0].FullName.Should().Be(typeof(SetActivationDeploymentsFullValidationRule).FullName); fullValidationRules[1].FullName.Should().Be(typeof(FetchCoinviewRule).FullName); fullValidationRules[2].FullName.Should().Be(typeof(TransactionDuplicationActivationRule).FullName); fullValidationRules[3].FullName.Should().Be(typeof(PowCoinviewRule).FullName); fullValidationRules[4].FullName.Should().Be(typeof(PushCoinviewRule).FullName); fullValidationRules[5].FullName.Should().Be(typeof(FlushCoinviewRule).FullName); }