Skip to content

Commit d7564a9

Browse files
committed
fix common.Hash conversion
1 parent 8987750 commit d7564a9

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

‎blockpool/peers.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"sync"
88
"time"
99

10+
"github.com/ethereum/go-ethereum/common"
1011
"github.com/ethereum/go-ethereum/core/types"
1112
"github.com/ethereum/go-ethereum/errs"
1213
)
@@ -471,6 +472,7 @@ func (self *peer) getBlockHashes() {
471472
}
472473
}
473474
headKey := self.parentHash.Str()
475+
height := self.bp.status.chain[headKey] + 1
474476
self.bp.status.chain[self.currentBlockHash.Str()] = height
475477
if height > self.bp.status.values.LongestChain {
476478
self.bp.status.values.LongestChain = height

‎blockpool/peers_test.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ func TestPeerPromotionByOptionalTdOnBlock(t *testing.T) {
170170
hashes := blockPoolTester.hashPool.IndexesToHashes([]int{2, 3})
171171
peer1.waitBlocksRequests(3)
172172
blockPool.AddBlock(&types.Block{
173-
HeaderHash: common.Bytes(hashes[1]),
174-
ParentHeaderHash: common.Bytes(hashes[0]),
173+
HeaderHash: common.Hash(hashes[1]),
174+
ParentHeaderHash: common.Hash(hashes[0]),
175175
Td: common.Big3,
176176
}, "peer1")
177177

‎blockpool/section.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ func (self *section) addSectionToBlockChain(p *peer) {
117117
break
118118
}
119119
self.poolRootIndex--
120-
keys = append(keys, node.hash.Str())
120+
keys = append(keys, n.hash.Str())
121121
blocks = append(blocks, block)
122122
nodes = append(nodes, n)
123123
}

0 commit comments

Comments
 (0)