File tree Expand file tree Collapse file tree 1 file changed +1
-12
lines changed Expand file tree Collapse file tree 1 file changed +1
-12
lines changed Original file line number Diff line number Diff line change 2121import trio
2222
2323from libp2p import new_host
24- from libp2p .bitswap import BitswapClient , MemoryBlockStore
24+ from libp2p .bitswap import BitswapClient , MemoryBlockStore , compute_cid
2525from libp2p .peer .peerinfo import info_from_p2p_addr
2626
2727# Enable logging
3737logger = logging .getLogger ("bitswap_example" )
3838
3939
40- def compute_cid (data : bytes ) -> bytes :
41- """
42- Compute a simple CID for data.
43-
44- Note: This is a simplified CID computation for demonstration.
45- In a real implementation, you should use proper CIDv0/CIDv1 encoding
46- with multihash and multicodec.
47- """
48- return hashlib .sha256 (data ).digest ()
49-
50-
5140async def run_provider (port : int = 0 , file_path : str | None = None ) -> None :
5241 """
5342 Run a Bitswap provider node that serves blocks.
You can’t perform that action at this time.
0 commit comments