Skip to content

Commit

Permalink
fix waitForMerge node address
Browse files Browse the repository at this point in the history
  • Loading branch information
nasdf committed Jun 12, 2024
1 parent 42c52d0 commit 7ac87b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
8 changes: 4 additions & 4 deletions net/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
pubsub "github.com/libp2p/go-libp2p-pubsub"
record "github.com/libp2p/go-libp2p-record"
libp2pCrypto "github.com/libp2p/go-libp2p/core/crypto"
"github.com/libp2p/go-libp2p/core/event"
libp2pEvent "github.com/libp2p/go-libp2p/core/event"
"github.com/libp2p/go-libp2p/core/host"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/core/routing"
Expand All @@ -47,7 +47,7 @@ import (

"github.com/sourcenetwork/defradb/client"
"github.com/sourcenetwork/defradb/crypto"
event1 "github.com/sourcenetwork/defradb/event"
"github.com/sourcenetwork/defradb/event"
)

var _ client.P2P = (*Node)(nil)
Expand Down Expand Up @@ -181,14 +181,14 @@ func NewNode(
return nil, fin.Cleanup(err)
}

sub, err := h.EventBus().Subscribe(&event.EvtPeerConnectednessChanged{})
sub, err := h.EventBus().Subscribe(&libp2pEvent.EvtPeerConnectednessChanged{})
if err != nil {
return nil, fin.Cleanup(err)

Check warning on line 186 in net/node.go

View check run for this annotation

Codecov / codecov/patch

net/node.go#L186

Added line #L186 was not covered by tests
}
// publish subscribed events to the event bus
go func() {
for val := range sub.Out() {
db.Events().Publish(event1.NewMessage(event1.PeerName, val))
db.Events().Publish(event.NewMessage(event.PeerName, val))
}
}()

Expand Down
7 changes: 2 additions & 5 deletions tests/integration/p2p.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,14 +501,11 @@ func waitForMerge(
targetToSourceEvents []int,
nodeSynced chan struct{},
) {
sourceNode := s.nodes[sourceNodeID]
targetNode := s.nodes[targetNodeID]

sourceSub := s.eventSubs[sourceNodeID]
targetSub := s.eventSubs[targetNodeID]

sourcePeerInfo := sourceNode.PeerInfo()
targetPeerInfo := targetNode.PeerInfo()
sourcePeerInfo := s.nodeAddresses[sourceNodeID]
targetPeerInfo := s.nodeAddresses[targetNodeID]

for waitIndex := 0; waitIndex < len(sourceToTargetEvents); waitIndex++ {
for i := 0; i < targetToSourceEvents[waitIndex]; i++ {
Expand Down

0 comments on commit 7ac87b9

Please sign in to comment.