fetch

suspend fun fetch(hash: BobbinHash): ByteArray

Returns the bytes for hash.

Returns from the local creel immediately if already cached. Otherwise broadcasts a FetchMessage.Request and suspends until a FetchMessage.Response arrives from a peer. The response bytes are verified via Creel.putVerified before being cached and returned.

Throws

if a received response's bytes do not hash to hash — indicating tampered or corrupt data.