Skip to content

Commit 527d12c

Browse files
author
Fabio Barone
committed
p2p/simulations: return edge distance in stream update
1 parent 1370269 commit 527d12c

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

p2p/simulations/network.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ import (
3737
"github.com/ethereum/go-ethereum/p2p"
3838
"github.com/ethereum/go-ethereum/p2p/discover"
3939
"github.com/ethereum/go-ethereum/p2p/simulations/adapters"
40-
"github.com/ethereum/go-ethereum/rpc"
4140
"github.com/ethereum/go-ethereum/pot"
41+
"github.com/ethereum/go-ethereum/rpc"
4242
)
4343

4444
type NetworkConfig struct {
@@ -167,9 +167,9 @@ type Conn struct {
167167
Up bool `json:"up"`
168168
// reverse is false by default (One dialled/dropped the Other)
169169
Reverse bool `json:"reverse"`
170-
// A scalar distance value denoting how "far" Other is from One (Kademlia table)
171-
Distance int `json:"distance"`
172-
// indicates if a ControlEvent has already been fired for this connection
170+
// A scalar distance value denoting how "far" Other is from One (Kademlia table)
171+
Distance int `json:"distance"`
172+
// indicates if a ControlEvent has already been fired for this connection
173173
controlFired bool
174174
}
175175

@@ -244,13 +244,13 @@ func (self *Network) newConn(oneID, otherID discover.NodeID) (*Conn, error) {
244244
if other == nil {
245245
return nil, fmt.Errorf("other %v does not exist", other)
246246
}
247-
distance, _ := pot.NewBytesVal(one.Addr(), nil).PO(pot.NewBytesVal(other.Addr(), nil), 0)
247+
distance, _ := pot.NewBytesVal(one.Addr(), nil).PO(pot.NewBytesVal(other.Addr(), nil), 0)
248248
return &Conn{
249-
One: oneID,
250-
Other: otherID,
251-
one: one,
252-
other: other,
253-
Distance: distance,
249+
One: oneID,
250+
Other: otherID,
251+
one: one,
252+
other: other,
253+
Distance: distance,
254254
}, nil
255255
}
256256

0 commit comments

Comments
 (0)