aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-01-13 00:19:14 +0800
committerobscuren <geffobscura@gmail.com>2014-01-13 00:19:14 +0800
commitf78bd4d5d0a6198c2c0e709440d9aa370e840617 (patch)
treecf12715f3ee3017810c2ec17fd035ce9f47097ab
parente280a2a7e3d51f0fb3b35e580332d9b51a7e50c1 (diff)
downloadgo-tangerine-f78bd4d5d0a6198c2c0e709440d9aa370e840617.tar
go-tangerine-f78bd4d5d0a6198c2c0e709440d9aa370e840617.tar.gz
go-tangerine-f78bd4d5d0a6198c2c0e709440d9aa370e840617.tar.bz2
go-tangerine-f78bd4d5d0a6198c2c0e709440d9aa370e840617.tar.lz
go-tangerine-f78bd4d5d0a6198c2c0e709440d9aa370e840617.tar.xz
go-tangerine-f78bd4d5d0a6198c2c0e709440d9aa370e840617.tar.zst
go-tangerine-f78bd4d5d0a6198c2c0e709440d9aa370e840617.zip
Format
-rw-r--r--block_manager.go8
-rw-r--r--peer.go11
2 files changed, 8 insertions, 11 deletions
diff --git a/block_manager.go b/block_manager.go
index 0c7410022..b6c2cace7 100644
--- a/block_manager.go
+++ b/block_manager.go
@@ -1,9 +1,9 @@
package main
import (
+ "errors"
"fmt"
"github.com/ethereum/ethutil-go"
- "errors"
"log"
"math/big"
)
@@ -24,7 +24,6 @@ func NewBlockChain() *BlockChain {
bc.TD = new(big.Int)
bc.TD.SetBytes(ethutil.Config.Db.LastKnownTD())
-
// TODO get last block from the database
//bc.LastBlock = bc.genesisBlock
@@ -136,7 +135,7 @@ func (bm *BlockManager) ValidateBlock(block *ethutil.Block) error {
// Check if we have the parent hash, if it isn't known we discard it
// Reasons might be catching up or simply an invalid block
if bm.bc.LastBlock != nil && block.PrevHash == "" &&
- !bm.bc.HasBlock(block.PrevHash) {
+ !bm.bc.HasBlock(block.PrevHash) {
return errors.New("Block's parent unknown")
}
@@ -154,7 +153,7 @@ func (bm *BlockManager) ValidateBlock(block *ethutil.Block) error {
// Verify the nonce of the block. Return an error if it's not valid
if bm.bc.LastBlock != nil && block.PrevHash == "" &&
- !DaggerVerify(ethutil.BigD(block.Hash()), block.Difficulty, block.Nonce) {
+ !DaggerVerify(ethutil.BigD(block.Hash()), block.Difficulty, block.Nonce) {
return errors.New("Block's nonce is invalid")
}
@@ -175,7 +174,6 @@ func (bm *BlockManager) AccumelateRewards(block *ethutil.Block) error {
// TODO Reward each uncle
-
return nil
}
diff --git a/peer.go b/peer.go
index 2dda1f94f..0875c6e45 100644
--- a/peer.go
+++ b/peer.go
@@ -1,8 +1,8 @@
package main
import (
- "github.com/ethereum/ethwire-go"
"github.com/ethereum/ethutil-go"
+ "github.com/ethereum/ethwire-go"
"log"
"net"
)
@@ -24,15 +24,15 @@ func NewPeer(conn net.Conn, server *Server, inbound bool) *Peer {
return &Peer{
outputQueue: make(chan *ethwire.InOutMsg, 1), // Buffered chan of 1 is enough
quit: make(chan bool),
- server: server,
- conn: conn,
- inbound: inbound,
+ server: server,
+ conn: conn,
+ inbound: inbound,
}
}
// Outputs any RLP encoded data to the peer
func (p *Peer) QueueMessage(msg *ethwire.InOutMsg) {
- p.outputQueue <- msg//ethwire.InOutMsg{MsgType: msgType, Nonce: ethutil.RandomUint64(), Data: data}
+ p.outputQueue <- msg //ethwire.InOutMsg{MsgType: msgType, Nonce: ethutil.RandomUint64(), Data: data}
}
// Outbound message handler. Outbound messages are handled here
@@ -145,4 +145,3 @@ func (p *Peer) handleVersionAck(msg *ethwire.InOutMsg) {
}
}
}
-