Package org.ethereum.util

Examples of org.ethereum.util.Value.encode()


            return EMPTY_TRIE_HASH;
        } else if (root instanceof byte[]) {
            return (byte[]) this.getRoot();
        } else {
            Value rootValue = new Value(this.getRoot());
            byte[] val = rootValue.encode();
            return HashUtil.sha3(val);
        }
    }

    /****************************************
 
View Full Code Here


   * @param o the Node which could be a pair-, multi-item Node or single Value 
   * @return sha3 hash of RLP encoded node if length > 32 otherwise return node itself
   */
  public Object put(Object o) {
    Value value = new Value(o);
    byte[] enc = value.encode();
    if (enc.length >= 32) {
      byte[] sha = HashUtil.sha3(enc);
      this.nodes.put(new ByteArrayWrapper(sha), new Node(value, true));
      this.isDirty = true;
      return sha;
View Full Code Here

        String testRlp = "f7808080d387206f72726563748a626574656c676575736580d387207870726573738a70726564696361626c658080808080808080808080";

        Value val = Value.fromRlpEncoded(Hex.decode(testRlp));

        assertEquals(testRlp, Hex.toHexString(val.encode()));
    }



}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.