aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-09-10 17:39:11 +0800
committerobscuren <geffobscura@gmail.com>2014-09-10 17:39:11 +0800
commitc0187930dc352c645c223e17364623a68413cb74 (patch)
tree4397d17557063fe0b0c30791b9737b1b76a65654
parent2f362509b813573f533a5be437c140355ddec7fc (diff)
downloadgo-tangerine-c0187930dc352c645c223e17364623a68413cb74.tar
go-tangerine-c0187930dc352c645c223e17364623a68413cb74.tar.gz
go-tangerine-c0187930dc352c645c223e17364623a68413cb74.tar.bz2
go-tangerine-c0187930dc352c645c223e17364623a68413cb74.tar.lz
go-tangerine-c0187930dc352c645c223e17364623a68413cb74.tar.xz
go-tangerine-c0187930dc352c645c223e17364623a68413cb74.tar.zst
go-tangerine-c0187930dc352c645c223e17364623a68413cb74.zip
Removed some commented code
-rw-r--r--ethvm/vm.go91
-rw-r--r--ethwire/messaging.go1
-rw-r--r--peer.go2
3 files changed, 2 insertions, 92 deletions
diff --git a/ethvm/vm.go b/ethvm/vm.go
index 9518540e0..fba8c4a0e 100644
--- a/ethvm/vm.go
+++ b/ethvm/vm.go
@@ -765,51 +765,7 @@ func (self *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
stack.Push(ethutil.BigD(addr))
}
- /*
- msg := self.env.State().Manifest().AddMessage(&ethstate.Message{
- To: addr, From: closure.Address(),
- Origin: self.env.Origin(),
- Block: self.env.BlockHash(), Timestamp: self.env.Time(), Coinbase: self.env.Coinbase(), Number: self.env.BlockNumber(),
- Value: value,
- })
-
- // Create a new contract
- contract := self.env.State().NewStateObject(addr)
- if contract.Balance.Cmp(value) >= 0 {
- closure.object.SubAmount(value)
- contract.AddAmount(value)
-
- // Set the init script
- initCode := mem.Get(offset.Int64(), size.Int64())
- msg.Input = initCode
-
- // Transfer all remaining gas to the new
- // contract so it may run the init script
- gas := new(big.Int).Set(closure.Gas)
- closure.UseGas(closure.Gas)
-
- // Create the closure
- c := NewClosure(msg, closure, contract, initCode, gas, closure.Price)
- // Call the closure and set the return value as
- // main script.
- contract.Code, _, err = c.Call(self, nil)
- } else {
- err = fmt.Errorf("Insufficient funds to transfer value. Req %v, has %v", value, closure.object.Balance)
- }
-
- if err != nil {
- stack.Push(ethutil.BigFalse)
-
- // Revert the state as it was before.
- self.env.State().Set(snapshot)
-
- self.Printf("CREATE err %v", err)
- } else {
- stack.Push(ethutil.BigD(addr))
- msg.Output = contract.Code
- }
- */
self.Endl()
// Debug hook
@@ -858,53 +814,6 @@ func (self *Vm) RunClosure(closure *Closure) (ret []byte, err error) {
self.Dbg.SetCode(closure.Code)
}
- /*
- msg := self.env.State().Manifest().AddMessage(&ethstate.Message{
- To: addr.Bytes(), From: closure.Address(),
- Input: args,
- Origin: self.env.Origin(),
- Block: self.env.BlockHash(), Timestamp: self.env.Time(), Coinbase: self.env.Coinbase(), Number: self.env.BlockNumber(),
- Value: value,
- })
-
- if closure.object.Balance.Cmp(value) < 0 {
- vmlogger.Debugf("Insufficient funds to transfer value. Req %v, has %v", value, closure.object.Balance)
-
- closure.ReturnGas(gas, nil)
-
- stack.Push(ethutil.BigFalse)
- } else {
- snapshot := self.env.State().Copy()
-
- stateObject := self.env.State().GetOrNewStateObject(addr.Bytes())
-
- closure.object.SubAmount(value)
- stateObject.AddAmount(value)
-
- // Create a new callable closure
- c := NewClosure(msg, closure, stateObject, stateObject.Code, gas, closure.Price)
- // Executer the closure and get the return value (if any)
- ret, _, err := c.Call(self, args)
- if err != nil {
- stack.Push(ethutil.BigFalse)
-
- vmlogger.Debugf("Closure execution failed. %v\n", err)
-
- self.env.State().Set(snapshot)
- } else {
- stack.Push(ethutil.BigTrue)
-
- mem.Set(retOffset.Int64(), retSize.Int64(), ret)
- }
-
- msg.Output = ret
-
- // Debug hook
- if self.Dbg != nil {
- self.Dbg.SetCode(closure.Code)
- }
- }
- */
case POST:
require(6)
diff --git a/ethwire/messaging.go b/ethwire/messaging.go
index c93c717a2..67a866f73 100644
--- a/ethwire/messaging.go
+++ b/ethwire/messaging.go
@@ -49,6 +49,7 @@ var msgTypeToString = map[MsgType]string{
MsgPingTy: "Ping",
MsgPongTy: "Pong",
MsgGetPeersTy: "Get peers",
+ MsgStatusTy: "Status",
MsgPeersTy: "Peers",
MsgTxTy: "Transactions",
MsgBlockTy: "Blocks",
diff --git a/peer.go b/peer.go
index a7259d712..5ca3ed641 100644
--- a/peer.go
+++ b/peer.go
@@ -694,7 +694,7 @@ func (p *Peer) handleHandshake(msg *ethwire.Msg) {
}
// Handle the pub key (validation, uniqueness)
- if pub == nil || len(pub) == 0 {
+ if len(pub) == 0 {
peerlogger.Warnln("Pubkey required, not supplied in handshake.")
p.Stop()
return