log changes

This commit is contained in:
obscuren 2014-06-12 10:07:27 +02:00
parent 1938bfcddf
commit 3a9d7d318a
4 changed files with 13 additions and 10 deletions

View File

@ -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)
}

View File

@ -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

View File

@ -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) {

View File

@ -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)