Beispiel #1
0
        public int GetLength(Block item, RlpBehaviors rlpBehaviors)
        {
            if (item == null)
            {
                return(1);
            }

            return(Rlp.LengthOfSequence(GetContentLength(item, rlpBehaviors).Total));
        }
Beispiel #2
0
        public int GetLength(LogEntry item, RlpBehaviors rlpBehaviors = RlpBehaviors.None)
        {
            if (item == null)
            {
                return(1);
            }

            return(Rlp.LengthOfSequence(GetContentLength(item).Total));
        }
Beispiel #3
0
        public int GetLength(Account item, RlpBehaviors rlpBehaviors = RlpBehaviors.None)
        {
            if (item == null)
            {
                return(1);
            }

            return(Rlp.LengthOfSequence(GetContentLength(item)));
        }
Beispiel #4
0
        public Rlp Encode(Account item, RlpBehaviors rlpBehaviors = RlpBehaviors.None)
        {
            if (item == null)
            {
                return(Rlp.OfEmptySequence);
            }

            int       contentLength = GetContentLength(item);
            RlpStream rlpStream     = new RlpStream(Rlp.LengthOfSequence(contentLength));

            rlpStream.StartSequence(contentLength);
            rlpStream.Encode(item.Nonce);
            rlpStream.Encode(item.Balance);
            rlpStream.Encode(item.StorageRoot);
            rlpStream.Encode(item.CodeHash);
            return(new Rlp(rlpStream.Data));
        }
Beispiel #5
0
 public int GetLength(TxReceipt item, RlpBehaviors rlpBehaviors)
 {
     return(Rlp.LengthOfSequence(GetContentLength(item, rlpBehaviors).Total));
 }
Beispiel #6
0
 public int GetLength(BlockHeader item, RlpBehaviors rlpBehaviors)
 {
     return(Rlp.LengthOfSequence(GetContentLength(item, rlpBehaviors)));
 }