HashRequest

data class HashRequest(val piecesRoot: ByteArray, val baseLayer: Int, val index: Int, val length: Int, val proofLayers: Int) : PeerMessage

hash_request (id 21, BEP-52): ask the peer for a range of v2 Merkle-tree hashes. The payload is a fixed 48-byte header: [pieces_root 32 bytes][int32 base][int32 index][int32 length][int32 proof_layers]. On the wire: [len=49][21][header]. Mirrors write_hash_request / on_hash_request in bt_peer_connection.cpp (the C++ hash_request carries file/base/index/count/proof_layers; the file is identified on the wire by its pieces_root, and count is named length here).

Constructors

Link copied to clipboard
constructor(piecesRoot: ByteArray, baseLayer: Int, index: Int, length: Int, proofLayers: Int)

Properties

Link copied to clipboard
Link copied to clipboard
open override val id: Int

The numeric message id, or -1 for KeepAlive (which has no id byte on the wire). Matches bt_peer_connection::message_type.

Link copied to clipboard
val index: Int
Link copied to clipboard
val length: Int
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open override fun encode(): ByteArray

The full on-the-wire frame: 4-byte big-endian length prefix + id + payload.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String