From 22f4c277dd7c2d67cffff2f75073c8fe298b6cb5 Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Thu, 8 Apr 2021 14:51:06 +0200 Subject: [PATCH] Revert "Add nitro wallet to BitswapNetwork" This reverts commit e55ac4e9de0dbb3f505db0b931a18759b52ff754. --- dagger/bitswap/network.nim | 5 ----- tests/dagger/bitswap/testbitswap.nim | 7 ++----- tests/dagger/bitswap/testnetwork.nim | 10 ++++------ tests/dagger/bitswap/utils.nim | 3 +-- 4 files changed, 7 insertions(+), 18 deletions(-) diff --git a/dagger/bitswap/network.nim b/dagger/bitswap/network.nim index 50ff7373..4b82876b 100644 --- a/dagger/bitswap/network.nim +++ b/dagger/bitswap/network.nim @@ -13,7 +13,6 @@ import pkg/chronicles import pkg/chronos import pkg/libp2p -import pkg/nitro import ../blocktype as bt import ./protobuf/bitswap as pb @@ -21,7 +20,6 @@ import ./protobuf/payments import ./networkpeer export pb, networkpeer -export nitro export payments logScope: @@ -65,7 +63,6 @@ type BitswapNetwork* = ref object of LPProtocol peers*: Table[PeerID, NetworkPeer] switch*: Switch - wallet*: Wallet handlers*: BitswapHandlers request*: BitswapRequest getConn: ConnProvider @@ -322,14 +319,12 @@ method init*(b: BitswapNetwork) = proc new*( T: type BitswapNetwork, switch: Switch, - wallet: Wallet, connProvider: ConnProvider = nil): T = ## Create a new BitswapNetwork instance ## let b = BitswapNetwork( switch: switch, - wallet: wallet, getConn: connProvider) proc sendWantList( diff --git a/tests/dagger/bitswap/testbitswap.nim b/tests/dagger/bitswap/testbitswap.nim index 5dcbb8ac..f44e48cb 100644 --- a/tests/dagger/bitswap/testbitswap.nim +++ b/tests/dagger/bitswap/testbitswap.nim @@ -28,7 +28,6 @@ suite "Bitswap engine - 2 nodes": var switch1, switch2: Switch - wallet1, wallet2: Wallet pricing1, pricing2: Pricing network1, network2: BitswapNetwork bitswap1, bitswap2: Bitswap @@ -42,8 +41,6 @@ suite "Bitswap engine - 2 nodes": switch1 = newStandardSwitch() switch2 = newStandardSwitch() - wallet1 = Wallet.init(EthPrivateKey.random()) - wallet2 = Wallet.init(EthPrivateKey.random()) pricing1 = Pricing.example pricing2 = Pricing.example awaiters.add(await switch1.start()) @@ -52,11 +49,11 @@ suite "Bitswap engine - 2 nodes": peerId1 = switch1.peerInfo.peerId peerId2 = switch2.peerInfo.peerId - network1 = BitswapNetwork.new(switch1, wallet1) + network1 = BitswapNetwork.new(switch = switch1) bitswap1 = Bitswap.new(MemoryStore.new(blocks1), network1) switch1.mount(network1) - network2 = BitswapNetwork.new(switch2, wallet2) + network2 = BitswapNetwork.new(switch = switch2) bitswap2 = Bitswap.new(MemoryStore.new(blocks2), network2) switch2.mount(network2) diff --git a/tests/dagger/bitswap/testnetwork.nim b/tests/dagger/bitswap/testnetwork.nim index ba5bf751..69fe68c7 100644 --- a/tests/dagger/bitswap/testnetwork.nim +++ b/tests/dagger/bitswap/testnetwork.nim @@ -39,7 +39,6 @@ suite "Bitswap network": buffer = newBufferStream() network = BitswapNetwork.new( switch = newStandardSwitch(), - wallet = Wallet.init(EthPrivateKey.random()), connProvider = getConn) network.setupPeer(peerId) networkPeer = network.peers[peerId] @@ -139,7 +138,6 @@ suite "Bitswap Network - e2e": var switch1, switch2: Switch - wallet1, wallet2: Wallet network1, network2: BitswapNetwork awaiters: seq[Future[void]] done: Future[void] @@ -148,15 +146,15 @@ suite "Bitswap Network - e2e": done = newFuture[void]() switch1 = newStandardSwitch() switch2 = newStandardSwitch() - wallet1 = Wallet.init(EthPrivateKey.random()) - wallet2 = Wallet.init(EthPrivateKey.random()) awaiters.add(await switch1.start()) awaiters.add(await switch2.start()) - network1 = BitswapNetwork.new(switch1, wallet1) + network1 = BitswapNetwork.new( + switch = switch1) switch1.mount(network1) - network2 = BitswapNetwork.new(switch2, wallet2) + network2 = BitswapNetwork.new( + switch = switch2) switch2.mount(network2) await switch1.connect( diff --git a/tests/dagger/bitswap/utils.nim b/tests/dagger/bitswap/utils.nim index 56fc9b1c..9bf3d4b2 100644 --- a/tests/dagger/bitswap/utils.nim +++ b/tests/dagger/bitswap/utils.nim @@ -17,8 +17,7 @@ proc generateNodes*( for i in 0..