Search in sources :

Example 16 with RLPList

use of org.ethereum.util.RLPList in project rskj by rsksmart.

the class ReceiptStoreImpl method getAll.

@Override
public List<TransactionInfo> getAll(byte[] transactionHash) {
    byte[] txsBytes = receiptsDS.get(transactionHash);
    if (txsBytes == null || txsBytes.length == 0) {
        return new ArrayList<TransactionInfo>();
    }
    List<TransactionInfo> txsInfo = new ArrayList<>();
    RLPList txsList = (RLPList) RLP.decode2(txsBytes).get(0);
    for (int i = 0; i < txsList.size(); ++i) {
        RLPList rlpData = ((RLPList) txsList.get(i));
        txsInfo.add(new TransactionInfo(rlpData.getRLPData()));
    }
    return txsInfo;
}
Also used : RLPList(org.ethereum.util.RLPList)

Example 17 with RLPList

use of org.ethereum.util.RLPList in project rskj by rsksmart.

the class BlockBodiesMessage method parse.

private void parse() {
    RLPList paramsList = (RLPList) RLP.decode2(encoded).get(0);
    blockBodies = new ArrayList<>();
    for (int i = 0; i < paramsList.size(); ++i) {
        RLPList rlpData = ((RLPList) paramsList.get(i));
        blockBodies.add(rlpData.getRLPData());
    }
    parsed = true;
}
Also used : RLPList(org.ethereum.util.RLPList)

Example 18 with RLPList

use of org.ethereum.util.RLPList in project rskj by rsksmart.

the class GetBlockBodiesMessage method parse.

private void parse() {
    RLPList paramsList = (RLPList) RLP.decode2(encoded).get(0);
    blockHashes = new ArrayList<>();
    for (int i = 0; i < paramsList.size(); ++i) {
        blockHashes.add(paramsList.get(i).getRLPData());
    }
    parsed = true;
}
Also used : RLPList(org.ethereum.util.RLPList)

Example 19 with RLPList

use of org.ethereum.util.RLPList in project rskj by rsksmart.

the class NewBlockHashesMessage method parse.

private void parse() {
    RLPList paramsList = (RLPList) RLP.decode2(encoded).get(0);
    blockIdentifiers = new ArrayList<>();
    for (int i = 0; i < paramsList.size(); ++i) {
        RLPList rlpData = ((RLPList) paramsList.get(i));
        blockIdentifiers.add(new BlockIdentifier(rlpData));
    }
    parsed = true;
}
Also used : BlockIdentifier(org.ethereum.core.BlockIdentifier) RLPList(org.ethereum.util.RLPList)

Example 20 with RLPList

use of org.ethereum.util.RLPList in project rskj by rsksmart.

the class NewBlockMessage method parse.

private void parse() {
    RLPList paramsList = (RLPList) RLP.decode2(encoded).get(0);
    RLPList blockRLP = ((RLPList) paramsList.get(0));
    block = new Block(blockRLP.getRLPData());
    difficulty = paramsList.get(1).getRLPData();
    parsed = true;
}
Also used : Block(org.ethereum.core.Block) RLPList(org.ethereum.util.RLPList)

Aggregations

RLPList (org.ethereum.util.RLPList)60 RLPElement (org.ethereum.util.RLPElement)19 Test (org.junit.Test)13 Keccak256 (co.rsk.crypto.Keccak256)8 RskAddress (co.rsk.core.RskAddress)7 BigInteger (java.math.BigInteger)5 RLPItem (org.ethereum.util.RLPItem)5 LogInfo (org.ethereum.vm.LogInfo)5 Script (co.rsk.bitcoinj.script.Script)3 ScriptChunk (co.rsk.bitcoinj.script.ScriptChunk)3 Coin (co.rsk.core.Coin)3 RepositoryImpl (co.rsk.db.RepositoryImpl)3 BridgeEventLogger (co.rsk.peg.utils.BridgeEventLogger)3 BridgeEventLoggerImpl (co.rsk.peg.utils.BridgeEventLoggerImpl)3 ByteArrayInputStream (java.io.ByteArrayInputStream)3 InputStream (java.io.InputStream)3 ArrayList (java.util.ArrayList)3 co.rsk.bitcoinj.core (co.rsk.bitcoinj.core)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 IOException (java.io.IOException)2