Package org.ethereum.util

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


        if (logger.isDebugEnabled())
          logger.debug("Retrieving key {}", Hex.toHexString(key));
        byte[] k = binToNibbles(key);
        Value c = new Value(this.get(this.root, k));

        return (c == null)? null : c.asBytes();
    }
   
    /**
     * Insert key/value pair into trie
     *
 
View Full Code Here


        // so no need to encode it
        if (!val.isBytes()) {
            return val;
        }

        byte[] keyBytes = val.asBytes();
        if (keyBytes.length == 0) {
            return val;
        } else if (keyBytes.length < 32) {
            return new Value(keyBytes);
        }
View Full Code Here

        if (node.isList()) {
            List<Object> siblings =  node.asList();
            if (siblings.size() == PAIR_SIZE) {
                Value val = new Value(siblings.get(1));
                if (val.isHashCode())
                    scanTree(val.asBytes(), scanAction);
            } else {
                for (int j = 0; j < LIST_SIZE; ++j) {
                    Value val = new Value(siblings.get(j));
                    if (val.isHashCode())
                        scanTree(val.asBytes(), scanAction);
View Full Code Here

                    scanTree(val.asBytes(), scanAction);
            } else {
                for (int j = 0; j < LIST_SIZE; ++j) {
                    Value val = new Value(siblings.get(j));
                    if (val.isHashCode())
                        scanTree(val.asBytes(), scanAction);
                }
            }
            scanAction.doOnNode(hash, node);
        }
    }
View Full Code Here

    Object[] interExp = new Object[]{1};
    assertTrue(new Value(inter.asObj()).cmp(new Value(interExp)));

    Value byt = new Value(new byte[]{1, 2, 3, 4});
    byte[] bytExp = new byte[]{1, 2, 3, 4};
    assertTrue(Arrays.equals(byt.asBytes(), bytExp));

    Value bigInt = new Value(BigInteger.valueOf(10));
    BigInteger bigExp = BigInteger.valueOf(10);
    assertEquals(bigInt.asBigInt(), bigExp);
  }
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.