Ejemplo n.º 1
0
  @Override
  public void parse(byte[] data) {
    RLPList list = (RLPList) RLP.decode2OneItem(data, 0);

    this.token = list.get(0).getRLPData();
    RLPItem expires = (RLPItem) list.get(1);
    this.expires = ByteUtil.byteArrayToLong(expires.getRLPData());
  }
Ejemplo n.º 2
0
  public TransactionInfo(byte[] rlp) {
    RLPList params = RLP.decode2(rlp);
    RLPList txInfo = (RLPList) params.get(0);
    RLPList receiptRLP = (RLPList) txInfo.get(0);
    RLPItem blockHashRLP = (RLPItem) txInfo.get(1);
    RLPItem indexRLP = (RLPItem) txInfo.get(2);

    receipt = new TransactionReceipt(receiptRLP.getRLPData());
    blockHash = blockHashRLP.getRLPData();
    if (indexRLP.getRLPData() == null) index = 0;
    else index = new BigInteger(1, indexRLP.getRLPData()).intValue();
  }
Ejemplo n.º 3
0
  @Override
  public void decode(byte[] rlpCode) {
    RLPList data = RLP.decode2(rlpCode);
    RLPList rlpList = (RLPList) data.get(0);

    RLPList keys = (RLPList) rlpList.get(0);
    RLPList values = (RLPList) rlpList.get(1);
    RLPElement code = rlpList.get(2);

    for (int i = 0; i < keys.size(); ++i) {

      RLPItem key = (RLPItem) keys.get(i);
      RLPItem value = (RLPItem) values.get(i);

      storage.put(new DataWord(key.getRLPData()), new DataWord(value.getRLPData()));
    }

    this.code = (code.getRLPData() == null) ? ByteUtil.EMPTY_BYTE_ARRAY : code.getRLPData();
  }