use of org.hyperledger.besu.ethereum.rlp.RLPInput in project besu by hyperledger.
the class ByteCodesMessage method bytecodes.
public ByteCodes bytecodes(final boolean withRequestId) {
final ArrayDeque<Bytes> codes = new ArrayDeque<>();
final RLPInput input = new BytesValueRLPInput(data, false);
input.enterList();
if (withRequestId)
input.skipNext();
input.enterList();
while (!input.isEndOfCurrentList()) {
codes.add(input.readBytes());
}
input.leaveList();
input.leaveList();
return ImmutableByteCodes.builder().codes(codes).build();
}
use of org.hyperledger.besu.ethereum.rlp.RLPInput in project besu by hyperledger.
the class GetAccountRangeMessage method range.
public Range range(final boolean withRequestId) {
final RLPInput input = new BytesValueRLPInput(data, false);
input.enterList();
if (withRequestId)
input.skipNext();
final Hash worldStateRootHash = Hash.wrap(Bytes32.wrap(input.readBytes32()));
final ImmutableRange range = ImmutableRange.builder().worldStateRootHash(getRootHash().orElse(worldStateRootHash)).startKeyHash(Hash.wrap(Bytes32.wrap(input.readBytes32()))).endKeyHash(Hash.wrap(Bytes32.wrap(input.readBytes32()))).responseBytes(input.readBigIntegerScalar()).build();
input.leaveList();
return range;
}
use of org.hyperledger.besu.ethereum.rlp.RLPInput in project besu by hyperledger.
the class GetReceiptsMessage method hashes.
public Iterable<Hash> hashes() {
final RLPInput input = new BytesValueRLPInput(data, false);
input.enterList();
final Collection<Hash> hashes = new ArrayList<>();
while (!input.isEndOfCurrentList()) {
hashes.add(Hash.wrap(input.readBytes32()));
}
input.leaveList();
return hashes;
}
use of org.hyperledger.besu.ethereum.rlp.RLPInput in project besu by hyperledger.
the class StorageRangeMessage method slotsData.
public SlotRangeData slotsData(final boolean withRequestId) {
final ArrayDeque<TreeMap<Bytes32, Bytes>> slots = new ArrayDeque<>();
final ArrayDeque<Bytes> proofs = new ArrayDeque<>();
final RLPInput input = new BytesValueRLPInput(data, false);
input.enterList();
if (withRequestId)
input.skipNext();
input.readList(accountRlpInput -> {
slots.add(new TreeMap<>());
return accountRlpInput.readList(slotRlpInput -> {
slotRlpInput.enterList();
slots.last().put(slotRlpInput.readBytes32(), slotRlpInput.readBytes());
slotRlpInput.leaveList();
// we don't need the response
return Void.TYPE;
});
});
input.enterList();
while (!input.isEndOfCurrentList()) {
proofs.add(input.readBytes());
}
input.leaveList();
input.leaveList();
return ImmutableSlotRangeData.builder().slots(slots).proofs(proofs).build();
}
use of org.hyperledger.besu.ethereum.rlp.RLPInput in project besu by hyperledger.
the class TrieNodesMessage method nodes.
public ArrayDeque<Bytes> nodes(final boolean withRequestId) {
final ArrayDeque<Bytes> trieNodes = new ArrayDeque<>();
final RLPInput input = new BytesValueRLPInput(data, false);
input.enterList();
if (withRequestId)
input.skipNext();
input.enterList();
while (!input.isEndOfCurrentList()) {
trieNodes.add(input.readBytes());
}
input.leaveList();
input.leaveList();
return trieNodes;
}
Aggregations