Description
Current implementation of libp2p-bitswap only allow fetching blocks from specific peers that are added apart of get
or sync
, but never allow adding any additional peers later on. I feel this should change especially due to rust-libp2p would stream the providers rather than collectively return them, and running multiple get
or sync
with different peers or providers may be counterproductive
I propose that get
or sync
functions would accept either a Stream
(or possibly have a separate function that would accept it one), or add a function, maybe called add_provider
or add_peer
, in which it would accept the query id as well as iterator of peers that could be added. I think the latter might be preferable as a single stream could be provided and polled by the behaviour for any additional peers that the stream could yield (which we may want to leave the query active until the stream is closed and no peers are provided or blocks have been found). Either way, it would improve fetching content from other peers as we would not have to wait to collect all the providers to them pass them along,