public Keccak DecodeStorageRootOnly(RlpStream rlpStream) { rlpStream.SkipLength(); rlpStream.SkipItem(); rlpStream.SkipItem(); Keccak storageRoot = rlpStream.DecodeKeccak(); return(storageRoot); }
public (Keccak CodeHash, Keccak StorageRoot) DecodeHashesOnly(RlpStream rlpStream, RlpBehaviors rlpBehaviors = RlpBehaviors.None) { rlpStream.SkipLength(); rlpStream.SkipItem(); rlpStream.SkipItem(); Keccak storageRoot = rlpStream.DecodeKeccak(); Keccak codeHash = rlpStream.DecodeKeccak(); return(codeHash, storageRoot); }
public (Keccak CodeHash, Keccak StorageRoot) DecodeHashesOnly(RlpStream rlpStream) { rlpStream.SkipLength(); rlpStream.SkipItem(); rlpStream.SkipItem(); Keccak storageRoot = DecodeStorageRoot(rlpStream); Keccak codeHash = DecodeCodeHash(rlpStream); return(codeHash, storageRoot); }
public TxReceipt Decode(RlpStream rlpStream, RlpBehaviors rlpBehaviors = RlpBehaviors.None) { if (rlpStream.IsNextItemNull()) { rlpStream.ReadByte(); return(null); } TxReceipt txReceipt = new(); if (!rlpStream.IsSequenceNext()) { rlpStream.SkipLength(); txReceipt.TxType = (TxType)rlpStream.ReadByte(); } _ = rlpStream.ReadSequenceLength(); byte[] firstItem = rlpStream.DecodeByteArray(); if (firstItem.Length == 1 && (firstItem[0] == 0 || firstItem[0] == 1)) { txReceipt.StatusCode = firstItem[0]; txReceipt.GasUsedTotal = (long)rlpStream.DecodeUBigInt(); } else if (firstItem.Length >= 1 && firstItem.Length <= 4) { txReceipt.GasUsedTotal = (long)firstItem.ToUnsignedBigInteger(); txReceipt.SkipStateAndStatusInRlp = true; } else { txReceipt.PostTransactionState = firstItem.Length == 0 ? null : new Keccak(firstItem); txReceipt.GasUsedTotal = (long)rlpStream.DecodeUBigInt(); } txReceipt.Bloom = rlpStream.DecodeBloom(); int lastCheck = rlpStream.ReadSequenceLength() + rlpStream.Position; int numberOfReceipts = rlpStream.ReadNumberOfItemsRemaining(lastCheck); LogEntry[] entries = new LogEntry[numberOfReceipts]; for (int i = 0; i < numberOfReceipts; i++) { entries[i] = Rlp.Decode <LogEntry>(rlpStream, RlpBehaviors.AllowExtraData); } txReceipt.Logs = entries; return(txReceipt); }