public void BlockPersistMovesTxToUnverified() { AddLowPriorityTransactions(30); AddHighPriorityTransactions(70); var block = new Block { Transactions = _unit.GetSortedVerifiedTransactions().Take(10) .Concat(_unit.GetSortedVerifiedTransactions().Where(x => x.IsLowPriority).Take(5)).ToArray() }; _unit.UpdatePoolForBlockPersisted(block, Blockchain.Singleton.GetSnapshot()); _unit.SortedLowPrioTxCount.ShouldBeEquivalentTo(0); _unit.SortedHighPrioTxCount.ShouldBeEquivalentTo(0); _unit.UnverifiedSortedHighPrioTxCount.ShouldBeEquivalentTo(60); _unit.UnverifiedSortedLowPrioTxCount.ShouldBeEquivalentTo(25); }
public void BlockPersistMovesTxToUnverifiedAndReverification() { AddTransactions(70); _unit.SortedTxCount.ShouldBeEquivalentTo(70); var block = new Block { Transactions = _unit.GetSortedVerifiedTransactions().Take(10) .Concat(_unit.GetSortedVerifiedTransactions().Take(5)).ToArray() }; _unit.UpdatePoolForBlockPersisted(block, Blockchain.Singleton.GetSnapshot()); _unit.InvalidateVerifiedTransactions(); _unit.SortedTxCount.ShouldBeEquivalentTo(0); _unit.UnverifiedSortedTxCount.ShouldBeEquivalentTo(60); _unit.ReVerifyTopUnverifiedTransactionsIfNeeded(10, Blockchain.Singleton.GetSnapshot()); _unit.SortedTxCount.ShouldBeEquivalentTo(10); _unit.UnverifiedSortedTxCount.ShouldBeEquivalentTo(50); _unit.ReVerifyTopUnverifiedTransactionsIfNeeded(10, Blockchain.Singleton.GetSnapshot()); _unit.SortedTxCount.ShouldBeEquivalentTo(20); _unit.UnverifiedSortedTxCount.ShouldBeEquivalentTo(40); _unit.ReVerifyTopUnverifiedTransactionsIfNeeded(10, Blockchain.Singleton.GetSnapshot()); _unit.SortedTxCount.ShouldBeEquivalentTo(30); _unit.UnverifiedSortedTxCount.ShouldBeEquivalentTo(30); _unit.ReVerifyTopUnverifiedTransactionsIfNeeded(10, Blockchain.Singleton.GetSnapshot()); _unit.SortedTxCount.ShouldBeEquivalentTo(40); _unit.UnverifiedSortedTxCount.ShouldBeEquivalentTo(20); _unit.ReVerifyTopUnverifiedTransactionsIfNeeded(10, Blockchain.Singleton.GetSnapshot()); _unit.SortedTxCount.ShouldBeEquivalentTo(50); _unit.UnverifiedSortedTxCount.ShouldBeEquivalentTo(10); _unit.ReVerifyTopUnverifiedTransactionsIfNeeded(10, Blockchain.Singleton.GetSnapshot()); _unit.SortedTxCount.ShouldBeEquivalentTo(60); _unit.UnverifiedSortedTxCount.ShouldBeEquivalentTo(0); }
public void BlockPersistMovesTxToUnverifiedAndReverification() { AddTransactions(70); _unit.SortedTxCount.Should().Be(70); var block = new Block { Header = new Header(), Transactions = _unit.GetSortedVerifiedTransactions().Take(10) .Concat(_unit.GetSortedVerifiedTransactions().Take(5)).ToArray() }; _unit.UpdatePoolForBlockPersisted(block, GetSnapshot()); _unit.InvalidateVerifiedTransactions(); _unit.SortedTxCount.Should().Be(0); _unit.UnverifiedSortedTxCount.Should().Be(60); _unit.ReVerifyTopUnverifiedTransactionsIfNeeded(10, GetSnapshot()); _unit.SortedTxCount.Should().Be(10); _unit.UnverifiedSortedTxCount.Should().Be(50); _unit.ReVerifyTopUnverifiedTransactionsIfNeeded(10, GetSnapshot()); _unit.SortedTxCount.Should().Be(20); _unit.UnverifiedSortedTxCount.Should().Be(40); _unit.ReVerifyTopUnverifiedTransactionsIfNeeded(10, GetSnapshot()); _unit.SortedTxCount.Should().Be(30); _unit.UnverifiedSortedTxCount.Should().Be(30); _unit.ReVerifyTopUnverifiedTransactionsIfNeeded(10, GetSnapshot()); _unit.SortedTxCount.Should().Be(40); _unit.UnverifiedSortedTxCount.Should().Be(20); _unit.ReVerifyTopUnverifiedTransactionsIfNeeded(10, GetSnapshot()); _unit.SortedTxCount.Should().Be(50); _unit.UnverifiedSortedTxCount.Should().Be(10); _unit.ReVerifyTopUnverifiedTransactionsIfNeeded(10, GetSnapshot()); _unit.SortedTxCount.Should().Be(60); _unit.UnverifiedSortedTxCount.Should().Be(0); }
public void BlockPersistMovesTxToUnverifiedAndReverification() { AddHighPriorityTransactions(70); AddLowPriorityTransactions(30); _unit.SortedHighPrioTxCount.ShouldBeEquivalentTo(70); _unit.SortedLowPrioTxCount.ShouldBeEquivalentTo(30); var block = new Block { Transactions = _unit.GetSortedVerifiedTransactions().Take(10) .Concat(_unit.GetSortedVerifiedTransactions().Where(x => x.IsLowPriority).Take(5)).ToArray() }; _unit.UpdatePoolForBlockPersisted(block, Blockchain.Singleton.GetSnapshot()); _unit.SortedHighPrioTxCount.ShouldBeEquivalentTo(0); _unit.SortedLowPrioTxCount.ShouldBeEquivalentTo(0); _unit.UnverifiedSortedHighPrioTxCount.ShouldBeEquivalentTo(60); _unit.UnverifiedSortedLowPrioTxCount.ShouldBeEquivalentTo(25); _unit.ReVerifyTopUnverifiedTransactionsIfNeeded(10, Blockchain.Singleton.GetSnapshot()); _unit.SortedHighPrioTxCount.ShouldBeEquivalentTo(9); _unit.SortedLowPrioTxCount.ShouldBeEquivalentTo(1); _unit.UnverifiedSortedHighPrioTxCount.ShouldBeEquivalentTo(51); _unit.UnverifiedSortedLowPrioTxCount.ShouldBeEquivalentTo(24); _unit.ReVerifyTopUnverifiedTransactionsIfNeeded(10, Blockchain.Singleton.GetSnapshot()); _unit.SortedHighPrioTxCount.ShouldBeEquivalentTo(18); _unit.SortedLowPrioTxCount.ShouldBeEquivalentTo(2); _unit.UnverifiedSortedHighPrioTxCount.ShouldBeEquivalentTo(42); _unit.UnverifiedSortedLowPrioTxCount.ShouldBeEquivalentTo(23); _unit.ReVerifyTopUnverifiedTransactionsIfNeeded(10, Blockchain.Singleton.GetSnapshot()); _unit.SortedHighPrioTxCount.ShouldBeEquivalentTo(27); _unit.SortedLowPrioTxCount.ShouldBeEquivalentTo(3); _unit.UnverifiedSortedHighPrioTxCount.ShouldBeEquivalentTo(33); _unit.UnverifiedSortedLowPrioTxCount.ShouldBeEquivalentTo(22); _unit.ReVerifyTopUnverifiedTransactionsIfNeeded(10, Blockchain.Singleton.GetSnapshot()); _unit.SortedHighPrioTxCount.ShouldBeEquivalentTo(36); _unit.SortedLowPrioTxCount.ShouldBeEquivalentTo(4); _unit.UnverifiedSortedHighPrioTxCount.ShouldBeEquivalentTo(24); _unit.UnverifiedSortedLowPrioTxCount.ShouldBeEquivalentTo(21); _unit.ReVerifyTopUnverifiedTransactionsIfNeeded(10, Blockchain.Singleton.GetSnapshot()); _unit.SortedHighPrioTxCount.ShouldBeEquivalentTo(45); _unit.SortedLowPrioTxCount.ShouldBeEquivalentTo(5); _unit.UnverifiedSortedHighPrioTxCount.ShouldBeEquivalentTo(15); _unit.UnverifiedSortedLowPrioTxCount.ShouldBeEquivalentTo(20); _unit.ReVerifyTopUnverifiedTransactionsIfNeeded(10, Blockchain.Singleton.GetSnapshot()); _unit.SortedHighPrioTxCount.ShouldBeEquivalentTo(54); _unit.SortedLowPrioTxCount.ShouldBeEquivalentTo(6); _unit.UnverifiedSortedHighPrioTxCount.ShouldBeEquivalentTo(6); _unit.UnverifiedSortedLowPrioTxCount.ShouldBeEquivalentTo(19); _unit.ReVerifyTopUnverifiedTransactionsIfNeeded(10, Blockchain.Singleton.GetSnapshot()); _unit.SortedHighPrioTxCount.ShouldBeEquivalentTo(60); _unit.SortedLowPrioTxCount.ShouldBeEquivalentTo(10); _unit.UnverifiedSortedHighPrioTxCount.ShouldBeEquivalentTo(0); _unit.UnverifiedSortedLowPrioTxCount.ShouldBeEquivalentTo(15); _unit.ReVerifyTopUnverifiedTransactionsIfNeeded(10, Blockchain.Singleton.GetSnapshot()); _unit.SortedHighPrioTxCount.ShouldBeEquivalentTo(60); _unit.SortedLowPrioTxCount.ShouldBeEquivalentTo(20); _unit.UnverifiedSortedHighPrioTxCount.ShouldBeEquivalentTo(0); _unit.UnverifiedSortedLowPrioTxCount.ShouldBeEquivalentTo(5); _unit.ReVerifyTopUnverifiedTransactionsIfNeeded(10, Blockchain.Singleton.GetSnapshot()); _unit.SortedHighPrioTxCount.ShouldBeEquivalentTo(60); _unit.SortedLowPrioTxCount.ShouldBeEquivalentTo(25); _unit.UnverifiedSortedHighPrioTxCount.ShouldBeEquivalentTo(0); _unit.UnverifiedSortedLowPrioTxCount.ShouldBeEquivalentTo(0); }