Search in sources :

Example 11 with Value

use of org.aion.rlp.Value in project aion by aionnetwork.

the class TrieImpl method getNode.

/**
 * Helper method to retrieve the actual node. If the node is not a list and
 * length is > 32 bytes get the actual node from the db.
 */
private Value getNode(Object node) {
    Value val = new Value(node);
    // 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);
    }
    return this.cache.get(keyBytes);
}
Also used : Value(org.aion.rlp.Value)

Aggregations

Value (org.aion.rlp.Value)11 ByteArrayWrapper (org.aion.base.util.ByteArrayWrapper)2 RLPItem (org.aion.rlp.RLPItem)1 RLPList (org.aion.rlp.RLPList)1