public static byte[] EncodeGetBlocksPayload(GetBlocksPayload getBlocksPayload) { using (var stream = new MemoryStream()) using (var writer = new BinaryWriter(stream)) { EncodeGetBlocksPayload(writer, getBlocksPayload); return stream.ToArray(); } }
public async Task SendGetBlocks(ImmutableArray <UInt256> blockLocatorHashes, UInt256 hashStop) { var getBlocksPayload = Messaging.ConstructGetBlocksPayload(blockLocatorHashes, hashStop); var getBlocksMessage = Messaging.ConstructMessage("getblocks", NetworkEncoder.EncodeGetBlocksPayload(getBlocksPayload)); await SendMessageAsync(getBlocksMessage); }