This commit is contained in:
zelig 2014-06-26 18:45:57 +01:00
parent da38faa8f7
commit 853053a3b2
14 changed files with 204 additions and 205 deletions

View File

@ -2,9 +2,9 @@ package ethchain
import (
"bytes"
"github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethwire"
"github.com/ethereum/eth-go/ethlog"
"math"
"math/big"
)

View File

@ -1,8 +1,8 @@
package ethchain
import (
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethutil"
"github.com/obscuren/sha3"
"hash"
"math/big"
@ -31,7 +31,6 @@ func (pow *EasyPow) Search(block *Block, reactChan chan ethutil.React) []byte {
for {
select {
case <-reactChan:
//powlogger.Infoln("Received reactor event; breaking out.")
return nil
default:
i++

View File

@ -3,9 +3,9 @@ package ethchain
import (
"bytes"
"container/list"
"github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethwire"
"github.com/ethereum/eth-go/ethlog"
"math/big"
"sync"
"time"

View File

@ -4,8 +4,8 @@ import (
"bytes"
"container/list"
"fmt"
"github.com/ethereum/eth-go/ethwire"
"github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethwire"
"math/big"
"sync"
)

View File

@ -2,8 +2,8 @@ package ethchain
import (
"fmt"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethutil"
"math"
"math/big"
)

View File

@ -5,10 +5,10 @@ import (
"fmt"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethdb"
"github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethrpc"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethwire"
"github.com/ethereum/eth-go/ethlog"
"io/ioutil"
"math/rand"
"net"

View File

@ -2,10 +2,10 @@ package ethlog
import (
"fmt"
"sync"
"log"
"io"
"log"
"os"
"sync"
)
type LogSystem interface {
@ -70,7 +70,8 @@ func start() {
// waits until log messages are drained (dispatched to log writers)
func Flush() {
for !drained {}
for !drained {
}
}
type Logger struct {
@ -185,4 +186,3 @@ func NewStdLogSystem(writer io.Writer, flags int, level LogLevel) *StdLogSystem
logger := log.New(writer, "", flags)
return &StdLogSystem{logger, level}
}

View File

@ -1,10 +1,10 @@
package ethlog
import (
"testing"
"fmt"
"io/ioutil"
"os"
"testing"
)
type TestLogSystem struct {
@ -107,9 +107,3 @@ func TestNoLogSystem(t *testing.T) {
logger.Warnln("warn")
Flush()
}

View File

@ -3,9 +3,9 @@ package ethminer
import (
"bytes"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethwire"
"github.com/ethereum/eth-go/ethlog"
"sort"
)
@ -57,18 +57,23 @@ func NewDefaultMiner(coinbase []byte, ethereum ethchain.EthManager) Miner {
return miner
}
func (miner *Miner) Start() {
// Prepare inital block
//miner.ethereum.StateManager().Prepare(miner.block.State(), miner.block.State())
go miner.listener()
logger.Infoln("Started")
}
func (miner *Miner) listener() {
out:
for {
select {
case <-miner.quitChan:
logger.Infoln("Stopped")
break out
case chanMessage := <-miner.reactChan:
if block, ok := chanMessage.Resource.(*ethchain.Block); ok {
//logger.Infoln("Got new block via Reactor")
if bytes.Compare(miner.ethereum.BlockChain().CurrentBlock.Hash(), block.Hash()) == 0 {
@ -123,8 +128,9 @@ out:
}
func (self *Miner) Stop() {
self.powQuitChan <- ethutil.React{}
logger.Infoln("Stopping...")
self.quitChan <- true
self.powQuitChan <- ethutil.React{}
}
func (self *Miner) mineNewBlock() {

View File

@ -5,8 +5,8 @@ import (
"encoding/hex"
"encoding/json"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethutil"
"math/big"
"strings"
"sync/atomic"

View File

@ -2,8 +2,8 @@ package ethrpc
import (
"fmt"
"github.com/ethereum/eth-go/ethpub"
"github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethpub"
"net"
"net/rpc"
"net/rpc/jsonrpc"

View File

@ -4,8 +4,8 @@ import (
"flag"
"fmt"
"github.com/rakyll/globalconf"
"runtime"
"os"
"runtime"
)
// Config struct

View File

@ -5,9 +5,9 @@ import (
"container/list"
"fmt"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethlog"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethwire"
"github.com/ethereum/eth-go/ethlog"
"net"
"strconv"
"strings"