-
Notifications
You must be signed in to change notification settings - Fork 20.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
p2p/*: golint updates for this or self warning #16577
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -336,26 +336,26 @@ func (*preminedTestnet) localAddr() *net.UDPAddr { | |
|
||
// 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) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From what I can tell, it looks like |
||
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 | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use
net
here.