diff options
author | obscuren <geffobscura@gmail.com> | 2015-03-16 18:27:38 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-03-16 18:27:38 +0800 |
commit | b5234413611ce5984292f85a01de1f56c045b490 (patch) | |
tree | e6e0c6f7fe8358a2dc63cdea11ac66b4f59397f5 /eth/backend.go | |
parent | 0b8f66ed9ef177dc72442dd7ba337c6733e30344 (diff) | |
download | go-tangerine-b5234413611ce5984292f85a01de1f56c045b490.tar.gz go-tangerine-b5234413611ce5984292f85a01de1f56c045b490.tar.zst go-tangerine-b5234413611ce5984292f85a01de1f56c045b490.zip |
Moved ethutil => common
Diffstat (limited to 'eth/backend.go')
-rw-r--r-- | eth/backend.go | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/eth/backend.go b/eth/backend.go index 346fc43bc..42f2b5808 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -14,7 +14,7 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/ethutil" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/logger" "github.com/ethereum/go-ethereum/miner" @@ -65,7 +65,7 @@ type Config struct { // NewDB is used to create databases. // If nil, the default is to create leveldb databases on disk. - NewDB func(path string) (ethutil.Database, error) + NewDB func(path string) (common.Database, error) } func (cfg *Config) parseBootNodes() []*discover.Node { @@ -113,9 +113,9 @@ type Ethereum struct { shutdownChan chan bool // DB interfaces - blockDb ethutil.Database // Block chain database - stateDb ethutil.Database // State changes database - extraDb ethutil.Database // Extra database (txs, etc) + blockDb common.Database // Block chain database + stateDb common.Database // State changes database + extraDb common.Database // Extra database (txs, etc) //*** SERVICES *** // State manager for processing new blocks and managing the over all states @@ -146,7 +146,7 @@ func New(config *Config) (*Ethereum, error) { newdb := config.NewDB if newdb == nil { - newdb = func(path string) (ethutil.Database, error) { return ethdb.NewLDBDatabase(path) } + newdb = func(path string) (common.Database, error) { return ethdb.NewLDBDatabase(path) } } blockDb, err := newdb(path.Join(config.DataDir, "blockchain")) if err != nil { @@ -160,7 +160,7 @@ func New(config *Config) (*Ethereum, error) { // Perform database sanity checks d, _ := blockDb.Get([]byte("ProtocolVersion")) - protov := ethutil.NewValue(d).Uint() + protov := common.NewValue(d).Uint() if protov != ProtocolVersion && protov != 0 { path := path.Join(config.DataDir, "blockchain") return nil, fmt.Errorf("Database version mismatch. Protocol(%d / %d). `rm -rf %s`", protov, ProtocolVersion, path) @@ -246,9 +246,9 @@ func (s *Ethereum) TxPool() *core.TxPool { return s.txPool } func (s *Ethereum) BlockPool() *blockpool.BlockPool { return s.blockPool } func (s *Ethereum) Whisper() *whisper.Whisper { return s.whisper } func (s *Ethereum) EventMux() *event.TypeMux { return s.eventMux } -func (s *Ethereum) BlockDb() ethutil.Database { return s.blockDb } -func (s *Ethereum) StateDb() ethutil.Database { return s.stateDb } -func (s *Ethereum) ExtraDb() ethutil.Database { return s.extraDb } +func (s *Ethereum) BlockDb() common.Database { return s.blockDb } +func (s *Ethereum) StateDb() common.Database { return s.stateDb } +func (s *Ethereum) ExtraDb() common.Database { return s.extraDb } func (s *Ethereum) IsListening() bool { return true } // Always listening func (s *Ethereum) PeerCount() int { return s.net.PeerCount() } func (s *Ethereum) Peers() []*p2p.Peer { return s.net.Peers() } @@ -351,11 +351,11 @@ func (self *Ethereum) blockBroadcastLoop() { } } -func saveProtocolVersion(db ethutil.Database) { +func saveProtocolVersion(db common.Database) { d, _ := db.Get([]byte("ProtocolVersion")) - protocolVersion := ethutil.NewValue(d).Uint() + protocolVersion := common.NewValue(d).Uint() if protocolVersion == 0 { - db.Put([]byte("ProtocolVersion"), ethutil.NewValue(ProtocolVersion).Bytes()) + db.Put([]byte("ProtocolVersion"), common.NewValue(ProtocolVersion).Bytes()) } } |