p2p: fix some golint warnings (#16577)
This commit is contained in:
@ -582,26 +582,26 @@ func (*preminedTestnet) ping(toid NodeID, toaddr *net.UDPAddr) error { return ni
|
||||
|
||||
// mine generates a testnet struct literal with nodes at
|
||||
// various distances to the given target.
|
||||
func (n *preminedTestnet) mine(target NodeID) {
|
||||
n.target = target
|
||||
n.targetSha = crypto.Keccak256Hash(n.target[:])
|
||||
func (tn *preminedTestnet) mine(target NodeID) {
|
||||
tn.target = target
|
||||
tn.targetSha = crypto.Keccak256Hash(tn.target[:])
|
||||
found := 0
|
||||
for found < bucketSize*10 {
|
||||
k := newkey()
|
||||
id := PubkeyID(&k.PublicKey)
|
||||
sha := crypto.Keccak256Hash(id[:])
|
||||
ld := logdist(n.targetSha, sha)
|
||||
if len(n.dists[ld]) < bucketSize {
|
||||
n.dists[ld] = append(n.dists[ld], id)
|
||||
ld := logdist(tn.targetSha, sha)
|
||||
if len(tn.dists[ld]) < bucketSize {
|
||||
tn.dists[ld] = append(tn.dists[ld], id)
|
||||
fmt.Println("found ID with ld", ld)
|
||||
found++
|
||||
}
|
||||
}
|
||||
fmt.Println("&preminedTestnet{")
|
||||
fmt.Printf(" target: %#v,\n", n.target)
|
||||
fmt.Printf(" targetSha: %#v,\n", n.targetSha)
|
||||
fmt.Printf(" dists: [%d][]NodeID{\n", len(n.dists))
|
||||
for ld, ns := range n.dists {
|
||||
fmt.Printf(" target: %#v,\n", tn.target)
|
||||
fmt.Printf(" targetSha: %#v,\n", tn.targetSha)
|
||||
fmt.Printf(" dists: [%d][]NodeID{\n", len(tn.dists))
|
||||
for ld, ns := range tn.dists {
|
||||
if len(ns) == 0 {
|
||||
continue
|
||||
}
|
||||
|
Reference in New Issue
Block a user