public static BlockHeadersMessage Deserialize(RlpStream rlpStream) { BlockHeadersMessage message = new BlockHeadersMessage(); message.BlockHeaders = Rlp.DecodeArray <BlockHeader>(rlpStream); return(message); }
public BlockHeadersMessage Deserialize(byte[] bytes) { BlockHeadersMessage message = new BlockHeadersMessage(); Rlp.DecoderContext context = bytes.AsRlpContext(); message.BlockHeaders = Rlp.DecodeArray<BlockHeader>(context); return message; }
public TransactionsMessage Deserialize(byte[] bytes) { TransactionsMessage message = new TransactionsMessage(); message.Transactions = Rlp.DecodeArray <Transaction>(bytes.AsRlpContext()); return(message); }
public PaymentClaim Decode(RlpStream rlpStream, RlpBehaviors rlpBehaviors = RlpBehaviors.None) { _ = rlpStream.ReadSequenceLength(); var id = rlpStream.DecodeKeccak(); var depositId = rlpStream.DecodeKeccak(); var assetId = rlpStream.DecodeKeccak(); var assetName = rlpStream.DecodeString(); var units = rlpStream.DecodeUInt(); var claimedUnits = rlpStream.DecodeUInt(); var unitsRange = Nethermind.Serialization.Rlp.Rlp.Decode <UnitsRange>(rlpStream); var value = rlpStream.DecodeUInt256(); var claimedValue = rlpStream.DecodeUInt256(); var expiryTime = rlpStream.DecodeUInt(); var pepper = rlpStream.DecodeByteArray(); var provider = rlpStream.DecodeAddress(); var consumer = rlpStream.DecodeAddress(); var transactions = Rlp.DecodeArray <TransactionInfo>(rlpStream); var transactionCost = rlpStream.DecodeUInt256(); var timestamp = rlpStream.DecodeUlong(); var status = (PaymentClaimStatus)rlpStream.DecodeInt(); var signature = SignatureDecoder.DecodeSignature(rlpStream); var paymentClaim = new PaymentClaim(id, depositId, assetId, assetName, units, claimedUnits, unitsRange, value, claimedValue, expiryTime, pepper, provider, consumer, signature, timestamp, transactions, status); if (status == PaymentClaimStatus.Claimed) { paymentClaim.SetTransactionCost(transactionCost); } return(paymentClaim); }
public DataAssetsMessage Deserialize(byte[] bytes) { DataAsset[] dataAssets; try { dataAssets = Rlp.DecodeArray <DataAsset>(bytes.AsRlpStream()); foreach (var dataAsset in dataAssets) { dataAsset.ClearPlugin(); } } catch (RlpException) { throw new InvalidDataException(); } return(new DataAssetsMessage(dataAssets)); }
public ParityLikeTxTrace[] ParityTraceBlock(UInt256 blockNumber, ParityTraceTypes parityTraceTypes) { Block block = _blockTree.FindBlock(blockNumber); bool loadedFromDb = true; List <ParityLikeTxTrace> result = new List <ParityLikeTxTrace>(); for (int i = 0; i < block.Transactions.Length; i++) { byte[] traceBytes = _traceDb.Get(block.Transactions[i].Hash); if (traceBytes != null) { result.Add(Rlp.Decode <ParityLikeTxTrace>(traceBytes)); } else { loadedFromDb = false; break; } } if (loadedFromDb) { byte[] traceBytes = _traceDb.Get(block.Hash); if (traceBytes != null) { result.AddRange(Rlp.DecodeArray <ParityLikeTxTrace>(new Rlp.DecoderContext(traceBytes), RlpBehaviors.None)); } } if (loadedFromDb) { return(result.ToArray()); } return(ParityTraceBlock(block, parityTraceTypes)); }
public Transaction[] DeserializeTxs(RlpStream rlpStream) { return(Rlp.DecodeArray <Transaction>(rlpStream)); }
private static TransactionsMessage Deserialize(RlpStream rlpStream) { Transaction[] txs = Rlp.DecodeArray <Transaction>(rlpStream); return(new TransactionsMessage(txs)); }
public DepositApprovalsMessage Deserialize(byte[] bytes) => new DepositApprovalsMessage(Rlp .DecodeArray <DepositApproval>(bytes.AsRlpStream()));