예제 #1
0
 internal void SetNull()
 {
     nVersion       = CURRENT_VERSION;
     hashPrevBlock  = 0;
     hashMerkleRoot = 0;
     nTime          = 0;
     nBits          = 0;
     nNonce         = 0;
     PosParameters  = new PosParameters();
 }
예제 #2
0
        public void Load(BitcoinStream stream)
        {
            using (@lock.LockWrite())
            {
                try
                {
                    int height = 0;
                    while (true)
                    {
                        uint256.MutableUint256 id = null;
                        stream.ReadWrite <uint256.MutableUint256>(ref id);
                        BlockHeader header = null;
                        stream.ReadWrite(ref header);
                        PosParameters posParameters = null;
                        stream.ReadWrite(ref posParameters);
                        header.PosParameters = posParameters;

                        if (height == 0)
                        {
                            _BlocksByHeight.Clear();
                            _BlocksById.Clear();
                            _Tip = null;
                            SetTipNoLock(new ChainedBlock(header, 0));
                        }
                        else
                        {
                            SetTipNoLock(new ChainedBlock(header, id.Value, Tip));
                        }
                        height++;
                    }
                }
                catch (EndOfStreamException)
                {
                }
            }
        }