diff --git a/ethchain/transaction_pool.go b/ethchain/transaction_pool.go index d4175d9735..103c305fea 100644 --- a/ethchain/transaction_pool.go +++ b/ethchain/transaction_pool.go @@ -162,6 +162,10 @@ func (pool *TxPool) ValidateTransaction(tx *Transaction) error { return errors.New("[TXPL] No last block on the block chain") } + if len(tx.Recipient) != 20 { + return fmt.Errorf("[TXPL] Invalid recipient. len = %d", len(tx.Recipient)) + } + // Get the sender //sender := pool.Ethereum.StateManager().procState.GetAccount(tx.Sender()) sender := pool.Ethereum.StateManager().CurrentState().GetAccount(tx.Sender()) @@ -207,6 +211,8 @@ out: // Call blocking version. pool.addTransaction(tx) + ethutil.Config.Log.Debugf("%x => %x (%v) %x\n", tx.Sender()[:4], tx.Recipient[:4], tx.Value, tx.Hash()) + // Notify the subscribers pool.Ethereum.Reactor().Post("newTx:pre", tx) } diff --git a/ethpub/pub.go b/ethpub/pub.go index e00bd0dbef..5c636f7a2d 100644 --- a/ethpub/pub.go +++ b/ethpub/pub.go @@ -193,8 +193,6 @@ func (lib *PEthereum) createTx(key, recipient, valueStr, gasStr, gasPriceStr, sc if contractCreation { ethutil.Config.Log.Infof("Contract addr %x", tx.CreationAddress()) - } else { - ethutil.Config.Log.Infof("Tx hash %x", tx.Hash()) } return NewPReciept(contractCreation, tx.CreationAddress(), tx.Hash(), keyPair.Address()), nil diff --git a/ethutil/config.go b/ethutil/config.go index e992bda12b..f935e8f75c 100644 --- a/ethutil/config.go +++ b/ethutil/config.go @@ -75,11 +75,11 @@ func ReadConfig(base string, logTypes LoggerType, g *globalconf.GlobalConf, id s if Config == nil { path := ApplicationFolder(base) - Config = &config{ExecPath: path, Debug: true, Ver: "0.5.0 RC12"} + Config = &config{ExecPath: path, Debug: true, Ver: "0.5.12"} Config.conf = g Config.Identifier = id Config.Log = NewLogger(logTypes, LogLevelDebug) - Config.SetClientString("/Ethereum(G)") + Config.SetClientString("Ethereum(G)") } return Config @@ -88,11 +88,9 @@ func ReadConfig(base string, logTypes LoggerType, g *globalconf.GlobalConf, id s // Set client string // func (c *config) SetClientString(str string) { - id := runtime.GOOS - if len(c.Identifier) > 0 { - id = c.Identifier - } - Config.ClientString = fmt.Sprintf("%s nv%s/%s", str, c.Ver, id) + os := runtime.GOOS + cust := c.Identifier + Config.ClientString = fmt.Sprintf("%s/v%s/%s/%s/Go", str, c.Ver, cust, os) } func (c *config) SetIdentifier(id string) { diff --git a/peer.go b/peer.go index 80975ff814..c7591ac31a 100644 --- a/peer.go +++ b/peer.go @@ -153,6 +153,7 @@ func NewPeer(conn net.Conn, ethereum *Ethereum, inbound bool) *Peer { pubkey: pubkey, blocksRequested: 10, caps: ethereum.ServerCaps(), + version: ethutil.Config.ClientString, } } @@ -579,7 +580,7 @@ func (p *Peer) pushHandshake() error { pubkey := keyRing.PublicKey msg := ethwire.NewMessage(ethwire.MsgHandshakeTy, []interface{}{ - uint32(ProtocolVersion), uint32(0), p.version, byte(p.caps), p.port, pubkey[1:], + uint32(ProtocolVersion), uint32(0), []byte(p.version), byte(p.caps), p.port, pubkey[1:], }) p.QueueMessage(msg)