public static void Encode(Span <byte> span, HistoricalBatch container) { if (span.Length != Ssz.HistoricalBatchLength()) { ThrowTargetLength <HistoricalBatch>(span.Length, Ssz.HistoricalBatchLength()); } Encode(span.Slice(0, Ssz.HistoricalBatchLength() / 2), container.BlockRoots); Encode(span.Slice(Ssz.HistoricalBatchLength() / 2), container.StateRoots); }
public static HistoricalBatch?DecodeHistoricalBatch(Span <byte> span) { if (span.Length != Ssz.HistoricalBatchLength()) { ThrowSourceLength <HistoricalBatch>(span.Length, Ssz.HistoricalBatchLength()); } Root[] blockRoots = DecodeRoots(span.Slice(0, Ssz.HistoricalBatchLength() / 2)); Root[] stateRoots = DecodeRoots(span.Slice(Ssz.HistoricalBatchLength() / 2)); HistoricalBatch container = new HistoricalBatch(blockRoots, stateRoots); return(container); }