Esempio n. 1
0
		public void CanSaveChain()
		{
			ConcurrentChain chain = new ConcurrentChain(Network.Main);
			AppendBlock(chain);
			AppendBlock(chain);
			var fork = AppendBlock(chain);
			AppendBlock(chain);



			var chain2 = new ConcurrentChain(chain.ToBytes());
			Assert.True(chain.SameTip(chain2));
		}
Esempio n. 2
0
        public void CanSaveChain()
        {
            ConcurrentChain chain = new ConcurrentChain(Network.Main);

            AppendBlock(chain);
            AppendBlock(chain);
            var fork = AppendBlock(chain);

            AppendBlock(chain);

            var chain2 = new ConcurrentChain(chain.ToBytes());

            Assert.True(chain.SameTip(chain2));
        }
        public void CanSaveChain()
        {
            var chain = new ConcurrentChain(Network.Main);

            this.AppendBlock(chain);
            this.AppendBlock(chain);
            ChainedHeader fork = this.AppendBlock(chain);

            this.AppendBlock(chain);

            var chain2 = new ConcurrentChain(chain.ToBytes());

            Assert.True(chain.SameTip(chain2));
        }
Esempio n. 4
0
		public void CanLoadAndSaveConcurrentChain()
		{
			ConcurrentChain cchain = new ConcurrentChain();
			ConcurrentChain chain = new ConcurrentChain(Network.Main);
			AddBlock(chain);
			AddBlock(chain);
			AddBlock(chain);

			cchain.SetTip(chain);

			var bytes = cchain.ToBytes();
			cchain = new ConcurrentChain();
			cchain.Load(bytes);

			Assert.Equal(cchain.Tip, chain.Tip);
			Assert.NotNull(cchain.GetBlock(0));

			cchain = new ConcurrentChain(Network.TestNet);
			cchain.Load(cchain.ToBytes());
			Assert.NotNull(cchain.GetBlock(0));
		}
Esempio n. 5
0
        public void CanLoadAndSaveConcurrentChain()
        {
            var cchain = new ConcurrentChain(this.network);
            var chain  = new ConcurrentChain(this.network);

            this.AddBlock(chain);
            this.AddBlock(chain);
            this.AddBlock(chain);

            cchain.SetTip(chain);

            byte[] bytes = cchain.ToBytes();
            cchain = new ConcurrentChain(this.network);
            cchain.Load(bytes);

            Assert.Equal(cchain.Tip, chain.Tip);
            Assert.NotNull(cchain.GetBlock(0));

            cchain = new ConcurrentChain(this.networkTest);
            cchain.Load(cchain.ToBytes());
            Assert.NotNull(cchain.GetBlock(0));
        }
Esempio n. 6
0
        public void CanLoadAndSaveConcurrentChain()
        {
            ConcurrentChain cchain = new ConcurrentChain();
            ConcurrentChain chain  = new ConcurrentChain(Network.Main);

            AddBlock(chain);
            AddBlock(chain);
            AddBlock(chain);

            cchain.SetTip(chain);

            var bytes = cchain.ToBytes();

            cchain = new ConcurrentChain();
            cchain.Load(bytes, Network.TestNet);

            Assert.Equal(cchain.Tip, chain.Tip);
            Assert.NotNull(cchain.GetBlock(0));

            cchain = new ConcurrentChain(Network.TestNet);
            cchain.Load(cchain.ToBytes(), Network.TestNet);
            Assert.NotNull(cchain.GetBlock(0));
        }