Skip to content

Commit

Permalink
Change gossip container SendConfig to nodeIDs
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronbuchwald committed Nov 22, 2024
1 parent 0ef6982 commit 325d861
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
9 changes: 4 additions & 5 deletions internal/gossiper/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"fmt"

"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/snow/engine/common"
"github.com/ava-labs/avalanchego/utils/set"
)

Expand Down Expand Up @@ -58,8 +57,8 @@ func (g *TargetProposers[T]) Target(ctx context.Context, txs []T) ([]GossipConta

return []GossipContainer[T]{
{
SendConfig: common.SendConfig{NodeIDs: recipients},
Txs: txs,
NodeIDs: recipients,
Txs: txs,
},
}, nil
}
Expand All @@ -86,8 +85,8 @@ func (t *TargetAssigner[T]) Target(ctx context.Context, txs []T) ([]GossipContai
gossipContainers := make([]GossipContainer[T], 0, len(targetedGossip))
for targetedNodeID, txs := range targetedGossip {
gossipContainers = append(gossipContainers, GossipContainer[T]{
SendConfig: common.SendConfig{NodeIDs: set.Of(targetedNodeID)},
Txs: txs,
NodeIDs: set.Of(targetedNodeID),
Txs: txs,
})
}
return gossipContainers, nil
Expand Down
7 changes: 4 additions & 3 deletions internal/gossiper/target.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/ava-labs/avalanchego/snow/engine/common"
"github.com/ava-labs/avalanchego/trace"
"github.com/ava-labs/avalanchego/utils/logging"
"github.com/ava-labs/avalanchego/utils/set"
"github.com/ava-labs/avalanchego/utils/timer"
"github.com/ava-labs/avalanchego/vms/proposervm/proposer"
"github.com/prometheus/client_golang/prometheus"
Expand Down Expand Up @@ -66,8 +67,8 @@ type TargetConfig struct {
}

type GossipContainer[T any] struct {
SendConfig common.SendConfig
Txs []T
NodeIDs set.Set[ids.NodeID]
Txs []T
}

func DefaultTargetConfig() *TargetConfig {
Expand Down Expand Up @@ -353,7 +354,7 @@ func (g *Target[T]) sendTxs(ctx context.Context, txs []T) error {
}

// Send gossip to specified peers
if err := g.client.AppGossip(ctx, gossipContainer.SendConfig, b); err != nil {
if err := g.client.AppGossip(ctx, common.SendConfig{NodeIDs: gossipContainer.NodeIDs}, b); err != nil {
return err
}
}
Expand Down

0 comments on commit 325d861

Please sign in to comment.