mirror of
https://github.com/logos-messaging/go-libp2p-pubsub.git
synced 2026-08-08 14:13:13 +00:00
add signed peer records only in the center of the star for signed peer record test
This commit is contained in:
parent
516a32c7ad
commit
94db23fd41
@ -1007,10 +1007,8 @@ func TestGossipsubStarTopologyWithSignedPeerRecords(t *testing.T) {
|
|||||||
psubs := getGossipsubs(ctx, hosts, WithPeerExchange(true))
|
psubs := getGossipsubs(ctx, hosts, WithPeerExchange(true))
|
||||||
|
|
||||||
// manually create signed peer records for each host and add them to the
|
// manually create signed peer records for each host and add them to the
|
||||||
// peerstores of the other hosts.
|
// peerstore of the center of the star, which is doing the bootstrapping
|
||||||
// this is necessary until the identify service is updated to exchange
|
for i := range hosts[1:] {
|
||||||
// signed records
|
|
||||||
for i := range hosts {
|
|
||||||
privKey := hosts[i].Peerstore().PrivKey(hosts[i].ID())
|
privKey := hosts[i].Peerstore().PrivKey(hosts[i].ID())
|
||||||
if privKey == nil {
|
if privKey == nil {
|
||||||
t.Fatalf("unable to get private key for host %s", hosts[i].ID().Pretty())
|
t.Fatalf("unable to get private key for host %s", hosts[i].ID().Pretty())
|
||||||
@ -1022,18 +1020,13 @@ func TestGossipsubStarTopologyWithSignedPeerRecords(t *testing.T) {
|
|||||||
t.Fatalf("error creating signed peer record: %s", err)
|
t.Fatalf("error creating signed peer record: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
for j := range hosts {
|
cab, ok := peerstore.GetCertifiedAddrBook(hosts[0].Peerstore())
|
||||||
if i == j {
|
if !ok {
|
||||||
continue
|
t.Fatal("peerstore does not implement CertifiedAddrBook")
|
||||||
}
|
}
|
||||||
cab, ok := peerstore.GetCertifiedAddrBook(hosts[j].Peerstore())
|
_, err = cab.ConsumePeerRecord(signedRec, peerstore.PermanentAddrTTL)
|
||||||
if !ok {
|
if err != nil {
|
||||||
t.Fatal("peerstore does not implement CertifiedAddrBook")
|
t.Fatalf("error adding signed peer record: %s", err)
|
||||||
}
|
|
||||||
_, err := cab.ConsumePeerRecord(signedRec, peerstore.PermanentAddrTTL)
|
|
||||||
if err != nil {
|
|
||||||
t.Fatalf("error adding signed peer record: %s", err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user