From f12f8a6c14dbaf6e6531cea1b0cf169b851e1894 Mon Sep 17 00:00:00 2001 From: Zsolt Felfoldi Date: Sat, 10 Dec 2016 06:50:36 +0100 Subject: les, light: add block availability check for ODR requests --- les/server.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'les/server.go') diff --git a/les/server.go b/les/server.go index 03cc2bb5e..e55616a44 100644 --- a/les/server.go +++ b/les/server.go @@ -349,9 +349,8 @@ func (pm *ProtocolManager) blockLoop() { } var ( - lastChtKey = []byte("LastChtNumber") // chtNum (uint64 big endian) - chtPrefix = []byte("cht") // chtPrefix + chtNum (uint64 big endian) -> trie root hash - chtConfirmations = light.ChtFrequency / 2 + lastChtKey = []byte("LastChtNumber") // chtNum (uint64 big endian) + chtPrefix = []byte("cht") // chtPrefix + chtNum (uint64 big endian) -> trie root hash ) func getChtRoot(db ethdb.Database, num uint64) common.Hash { @@ -372,8 +371,8 @@ func makeCht(db ethdb.Database) bool { headNum := core.GetBlockNumber(db, headHash) var newChtNum uint64 - if headNum > chtConfirmations { - newChtNum = (headNum - chtConfirmations) / light.ChtFrequency + if headNum > light.ChtConfirmations { + newChtNum = (headNum - light.ChtConfirmations) / light.ChtFrequency } var lastChtNum uint64 -- cgit