aboutsummaryrefslogtreecommitdiffstats
path: root/chain/chain_manager.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-12-02 03:18:09 +0800
committerobscuren <geffobscura@gmail.com>2014-12-02 03:18:09 +0800
commit6dc46d3341dc5fa25bd005f9606de258874139be (patch)
tree39b5d7dad5a943de4e187f99c93da5aa7fc9f2b8 /chain/chain_manager.go
parenta3559c5e1b469890bb8d71e9992175febaae31c7 (diff)
downloaddexon-6dc46d3341dc5fa25bd005f9606de258874139be.tar
dexon-6dc46d3341dc5fa25bd005f9606de258874139be.tar.gz
dexon-6dc46d3341dc5fa25bd005f9606de258874139be.tar.bz2
dexon-6dc46d3341dc5fa25bd005f9606de258874139be.tar.lz
dexon-6dc46d3341dc5fa25bd005f9606de258874139be.tar.xz
dexon-6dc46d3341dc5fa25bd005f9606de258874139be.tar.zst
dexon-6dc46d3341dc5fa25bd005f9606de258874139be.zip
Changed the way transactions are being added to the transaction pool
Diffstat (limited to 'chain/chain_manager.go')
-rw-r--r--chain/chain_manager.go21
1 files changed, 21 insertions, 0 deletions
diff --git a/chain/chain_manager.go b/chain/chain_manager.go
index 0c3a7a928..75c8b22a2 100644
--- a/chain/chain_manager.go
+++ b/chain/chain_manager.go
@@ -322,6 +322,24 @@ func NewChain(blocks Blocks) *BlockChain {
}
// This function assumes you've done your checking. No checking is done at this stage anymore
+func (self *ChainManager) InsertChain(chain Blocks) error {
+ for _, block := range chain {
+ td, messages, err := self.Ethereum.BlockManager().Process(block)
+ if err != nil {
+ return err
+ }
+
+ self.add(block)
+ self.SetTotalDifficulty(td)
+ self.Ethereum.EventMux().Post(NewBlockEvent{block})
+ self.Ethereum.EventMux().Post(messages)
+ }
+
+ return nil
+}
+
+/*
+// This function assumes you've done your checking. No checking is done at this stage anymore
func (self *ChainManager) InsertChain(chain *BlockChain) {
for e := chain.Front(); e != nil; e = e.Next() {
link := e.Value.(*link)
@@ -338,7 +356,9 @@ func (self *ChainManager) InsertChain(chain *BlockChain) {
chainlogger.Infof("Imported %d blocks. #%v (%x) / %#v (%x)", chain.Len(), front.Number, front.Hash()[0:4], back.Number, back.Hash()[0:4])
}
}
+*/
+/*
func (self *ChainManager) TestChain(chain *BlockChain) (td *big.Int, err error) {
self.workingChain = chain
defer func() { self.workingChain = nil }()
@@ -381,3 +401,4 @@ func (self *ChainManager) TestChain(chain *BlockChain) (td *big.Int, err error)
return
}
+*/