aboutsummaryrefslogtreecommitdiffstats
path: root/ethminer/miner.go
diff options
context:
space:
mode:
authorMaran <maran.hidskes@gmail.com>2014-03-21 22:06:23 +0800
committerMaran <maran.hidskes@gmail.com>2014-03-21 22:06:23 +0800
commitb52b1fca89fd56549ecc0f086d96a39d6009e568 (patch)
tree9e3de2573149ffabfa0eff9b81e4849ad5af36ae /ethminer/miner.go
parentae837c4719855384921fcaadb1a575942dc9833d (diff)
downloadgo-tangerine-b52b1fca89fd56549ecc0f086d96a39d6009e568.tar.gz
go-tangerine-b52b1fca89fd56549ecc0f086d96a39d6009e568.tar.zst
go-tangerine-b52b1fca89fd56549ecc0f086d96a39d6009e568.zip
Initial block reorganisation code
Diffstat (limited to 'ethminer/miner.go')
-rw-r--r--ethminer/miner.go19
1 files changed, 9 insertions, 10 deletions
diff --git a/ethminer/miner.go b/ethminer/miner.go
index f4f697aba..cb752e3de 100644
--- a/ethminer/miner.go
+++ b/ethminer/miner.go
@@ -61,10 +61,10 @@ func (miner *Miner) listener() {
select {
case chanMessage := <-miner.reactChan:
if block, ok := chanMessage.Resource.(*ethchain.Block); ok {
- log.Println("[miner] Got new block via Reactor")
+ log.Println("[MINER] Got new block via Reactor")
if bytes.Compare(miner.ethereum.BlockChain().CurrentBlock.Hash(), block.Hash()) == 0 {
// TODO: Perhaps continue mining to get some uncle rewards
- log.Println("[miner] New top block found resetting state")
+ log.Println("[MINER] New top block found resetting state")
// Filter out which Transactions we have that were not in this block
var newtxs []*ethchain.Transaction
@@ -86,7 +86,7 @@ func (miner *Miner) listener() {
} else {
if bytes.Compare(block.PrevHash, miner.ethereum.BlockChain().CurrentBlock.PrevHash) == 0 {
- log.Println("[miner] Adding uncle block")
+ log.Println("[MINER] Adding uncle block")
miner.uncles = append(miner.uncles, block)
miner.ethereum.StateManager().Prepare(miner.block.State(), miner.block.State())
}
@@ -94,7 +94,7 @@ func (miner *Miner) listener() {
}
if tx, ok := chanMessage.Resource.(*ethchain.Transaction); ok {
- log.Println("[miner] Got new transaction from Reactor", tx)
+ log.Println("[MINER] Got new transaction from Reactor", tx)
found := false
for _, ctx := range miner.txs {
if found = bytes.Compare(ctx.Hash(), tx.Hash()) == 0; found {
@@ -103,15 +103,15 @@ func (miner *Miner) listener() {
}
if found == false {
- log.Println("[miner] We did not know about this transaction, adding")
+ log.Println("[MINER] We did not know about this transaction, adding")
miner.txs = append(miner.txs, tx)
miner.block.SetTransactions(miner.txs)
} else {
- log.Println("[miner] We already had this transaction, ignoring")
+ log.Println("[MINER] We already had this transaction, ignoring")
}
}
default:
- log.Println("[miner] Mining on block. Includes", len(miner.txs), "transactions")
+ log.Println("[MINER] Mining on block. Includes", len(miner.txs), "transactions")
// Apply uncles
if len(miner.uncles) > 0 {
@@ -123,7 +123,7 @@ func (miner *Miner) listener() {
miner.ethereum.StateManager().AccumelateRewards(miner.block)
// Search the nonce
- log.Println("[miner] Initialision complete, starting mining")
+ log.Println("[MINER] Initialision complete, starting mining")
miner.block.Nonce = miner.pow.Search(miner.block, miner.quitChan)
if miner.block.Nonce != nil {
miner.ethereum.StateManager().PrepareDefault(miner.block)
@@ -137,8 +137,7 @@ func (miner *Miner) listener() {
log.Printf("Second stage verification error: Block's nonce is invalid (= %v)\n", ethutil.Hex(miner.block.Nonce))
}
miner.ethereum.Broadcast(ethwire.MsgBlockTy, []interface{}{miner.block.Value().Val})
- log.Printf("[miner] 🔨 Mined block %x\n", miner.block.Hash())
- log.Println(miner.block)
+ log.Printf("[MINER] 🔨 Mined block %x\n", miner.block.Hash())
miner.txs = []*ethchain.Transaction{} // Move this somewhere neat
miner.block = miner.ethereum.BlockChain().NewBlock(miner.coinbase, miner.txs)