Exemplo n.º 1
0
        public static ConsensusData ConsensusDataFromJson(JObject json)
        {
            ConsensusData block = new ConsensusData();

            block.PrimaryIndex = (uint)json["primary"].AsNumber();
            block.Nonce        = ulong.Parse(json["nonce"].AsString(), NumberStyles.HexNumber);
            return(block);
        }
Exemplo n.º 2
0
 public override void Deserialize(BinaryReader reader)
 {
     base.Deserialize(reader);
     Hashes = reader.ReadSerializableArray <UInt256>(Block.MaxContentsPerBlock);
     if (Hashes.Length > 0)
     {
         ConsensusData = reader.ReadSerializable <ConsensusData>();
     }
 }
Exemplo n.º 3
0
 public ConsensusDataModel(ConsensusData consensus)
 {
     if (consensus != null)
     {
         Hash         = consensus.Hash;
         PrimaryIndex = consensus.PrimaryIndex;
         Nonce        = consensus.Nonce.ToString();
     }
 }
Exemplo n.º 4
0
 void ICloneable <TrimmedBlock> .FromReplica(TrimmedBlock replica)
 {
     Version       = replica.Version;
     PrevHash      = replica.PrevHash;
     MerkleRoot    = replica.MerkleRoot;
     Timestamp     = replica.Timestamp;
     Index         = replica.Index;
     NextConsensus = replica.NextConsensus;
     Witness       = replica.Witness;
     Hashes        = replica.Hashes;
     ConsensusData = replica.ConsensusData;
     _header       = replica._header;
 }
Exemplo n.º 5
0
 public override void Deserialize(BinaryReader reader)
 {
     base.Deserialize(reader);
     ConsensusData = reader.ReadSerializable <ConsensusData>();
     Hashes        = reader.ReadSerializableArray <UInt256>(Block.MaxTransactionsPerBlock);
 }