aboutsummaryrefslogtreecommitdiffstats
path: root/block_pool.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-11-18 23:58:22 +0800
committerobscuren <geffobscura@gmail.com>2014-11-18 23:58:22 +0800
commita1b6a9ac29d0aa8d29a2c0535bafdb5fe4d4830b (patch)
treeaee891c8f02591e16377a6bf047c13f12d6d5123 /block_pool.go
parent62cd9946ee16758a4e368cd0b5a0ba9fa4d94705 (diff)
downloadgo-tangerine-a1b6a9ac29d0aa8d29a2c0535bafdb5fe4d4830b.tar
go-tangerine-a1b6a9ac29d0aa8d29a2c0535bafdb5fe4d4830b.tar.gz
go-tangerine-a1b6a9ac29d0aa8d29a2c0535bafdb5fe4d4830b.tar.bz2
go-tangerine-a1b6a9ac29d0aa8d29a2c0535bafdb5fe4d4830b.tar.lz
go-tangerine-a1b6a9ac29d0aa8d29a2c0535bafdb5fe4d4830b.tar.xz
go-tangerine-a1b6a9ac29d0aa8d29a2c0535bafdb5fe4d4830b.tar.zst
go-tangerine-a1b6a9ac29d0aa8d29a2c0535bafdb5fe4d4830b.zip
Begin of moving objects to types package
* Block(s) * Transaction(s)
Diffstat (limited to 'block_pool.go')
-rw-r--r--block_pool.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/block_pool.go b/block_pool.go
index f9bd3b28e..dcddca58e 100644
--- a/block_pool.go
+++ b/block_pool.go
@@ -10,6 +10,7 @@ import (
"time"
"github.com/ethereum/go-ethereum/chain"
+ "github.com/ethereum/go-ethereum/chain/types"
"github.com/ethereum/go-ethereum/ethutil"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/wire"
@@ -20,7 +21,7 @@ var poollogger = logger.NewLogger("BPOOL")
type block struct {
from *Peer
peer *Peer
- block *chain.Block
+ block *types.Block
reqAt time.Time
requested int
}
@@ -73,7 +74,7 @@ func (self *BlockPool) HasCommonHash(hash []byte) bool {
return self.eth.ChainManager().GetBlock(hash) != nil
}
-func (self *BlockPool) Blocks() (blocks chain.Blocks) {
+func (self *BlockPool) Blocks() (blocks types.Blocks) {
for _, item := range self.pool {
if item.block != nil {
blocks = append(blocks, item.block)
@@ -123,15 +124,15 @@ func (self *BlockPool) AddHash(hash []byte, peer *Peer) {
}
}
-func (self *BlockPool) Add(b *chain.Block, peer *Peer) {
+func (self *BlockPool) Add(b *types.Block, peer *Peer) {
self.addBlock(b, peer, false)
}
-func (self *BlockPool) AddNew(b *chain.Block, peer *Peer) {
+func (self *BlockPool) AddNew(b *types.Block, peer *Peer) {
self.addBlock(b, peer, true)
}
-func (self *BlockPool) addBlock(b *chain.Block, peer *Peer, newBlock bool) {
+func (self *BlockPool) addBlock(b *types.Block, peer *Peer, newBlock bool) {
self.mut.Lock()
defer self.mut.Unlock()
@@ -283,7 +284,7 @@ out:
break out
case <-procTimer.C:
blocks := self.Blocks()
- chain.BlockBy(chain.Number).Sort(blocks)
+ types.BlockBy(types.Number).Sort(blocks)
// Find common block
for i, block := range blocks {