Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
b00ris committed Apr 16, 2018
1 parent a26c3a0 commit c1f6710
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
3 changes: 3 additions & 0 deletions les/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,9 @@ func (f *lightFetcher) checkTrusted(hash common.Hash, minTrustedFraction int) bo
numAgreed = numAgreed + 1
}

return checkTrustedFractionBarrier(numAgreed, numPeers, minTrustedFraction)
}
func checkTrustedFractionBarrier(numAgreed, numPeers, minTrustedFraction int) bool {
return 100*numAgreed/numPeers > minTrustedFraction
}

Expand Down
7 changes: 0 additions & 7 deletions les/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,13 +308,6 @@ func (p *testPeer) handshake(t *testing.T, td *big.Int, head common.Hash, headNu
expList = expList.add("flowControl/MRR", uint64(1))
expList = expList.add("flowControl/MRC", testRCL())

//var kv keyValueList
//msg, err := p.app.ReadMsg()
//t.Log(err)
//msg.Decode(&kv)
//t.Fatal(kv)
//[{protocolVersion [1]} {networkId [1]} {headTd [132 4 30 0 0]} {headHash [160 125 69 111 26 172 233 200 16 23 215 15 198 132 121 206 250 12 59 41 82 245 51 198 252 254 168 11 162 212 207 86 190]} {headNum [130 2 15]} {genesisHash [160 233 102 66 91 250 196 145 214 140 22 208 229 199 65 196 222 197 98 48 118 112 8 133 4 163 222 173 239 151 118 153 72]} {announceType [1]} {serveHeaders [128]} {serveChainSince [128]} {serveStateSince [128]} {txRelay [128]} {flowControl/BL [100]} {flowControl/MRR [1]} {flowControl/MRC [236 195 2 128 128 195 4 128 128 195 10 128 128 195 6 128 128 195 8 128 128 195 12 128 128 195 19 128 128 195 20 128 128 195 13 128 128 195 15 128 128 195 17 128 128]}]

if err := p2p.ExpectMsg(p.app, StatusMsg, expList); err != nil {
t.Fatalf("status recv: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion les/peer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func TestPeer_Handshake_AnnounceTypeSigned_ForTrustedPeers_PeerNotInTrusted_Fail
version: protocol_version,
rw: &rwStub{
WriteHook: func(recvList keyValueList) {
//checking that ulc sends to peer allowedRequests=onlyAnnounceRequests and announceType = announceTypeSigned
//checking that ulc sends to peer allowedRequests=noRequests and announceType != announceTypeSigned
recv := recvList.decode()
var a, reqType uint64
err := recv.get("allowedRequests", &a)
Expand Down

0 comments on commit c1f6710

Please sign in to comment.