Esempio n. 1
0
        public void Init()
        {
            var fakeHeaders = new FakeHeaders();
            this.chainedHeader0 = fakeHeaders.GenesisChained();
            this.chainedHeader1 = fakeHeaders.NextChained();

            var fakeHeadersA = new FakeHeaders(fakeHeaders);
            this.chainedHeaderA2 = fakeHeadersA.NextChained();
            this.chainedHeaderA3 = fakeHeadersA.NextChained();
            this.chainedHeaderA4 = fakeHeadersA.NextChained();

            var fakeHeadersB = new FakeHeaders(fakeHeaders);
            this.chainedHeaderB2 = fakeHeadersB.NextChained();
            this.chainedHeaderB3 = fakeHeadersB.NextChained();
            this.chainedHeaderB4 = fakeHeadersB.NextChained();

            var fakeHeadersX = new FakeHeaders();
            this.chainedHeaderX0 = fakeHeadersX.GenesisChained();
            this.chainedHeaderX1 = fakeHeadersX.NextChained();

            this.chain = ImmutableDictionary.CreateRange(
                new[] { chainedHeader0, chainedHeader1, chainedHeaderA2, chainedHeaderA3, chainedHeaderA4, chainedHeaderB2, chainedHeaderB3, chainedHeaderB4, chainedHeaderX0, chainedHeaderX1 }
                .Select(x => new KeyValuePair<UInt256, ChainedHeader>(x.Hash, x)));

            this.getChainedHeader = blockHash => this.chain[blockHash];
        }
Esempio n. 2
0
 public FakeHeaders(FakeHeaders parent)
 {
     this.blockHeaders = new List <BlockHeader>(parent.blockHeaders);
     this.nonce        = (UInt32)Interlocked.Increment(ref staticNonce);
 }
Esempio n. 3
0
 public FakeHeaders(FakeHeaders parent)
     : this(parent.blockHeaders)
 {
 }
Esempio n. 4
0
 public FakeHeaders(FakeHeaders parent)
     : this(parent.blockHeaders)
 {
 }