add pushtx to api

Previously the software assumed use of an internal private key for use in all broadcasted transactions. This addition lets nodes relay pre-signed transactions originating from sources other than the node itself.
This commit is contained in:
Cayman Nava
2014-09-06 13:51:13 -07:00
parent 6afc16399f
commit 7dacd7eb78
3 changed files with 36 additions and 0 deletions

View File

@ -149,6 +149,15 @@ func (self *Pipe) Transact(key *ethcrypto.KeyPair, rec []byte, value, gas, price
return tx.Hash(), nil
}
func (self *Pipe) PushTx(tx *ethchain.Transaction) ([]byte, error) {
self.obj.TxPool().QueueTransaction(tx)
if tx.Recipient == nil {
logger.Infof("Contract addr %x", tx.CreationAddress())
return tx.CreationAddress(), nil
}
return tx.Hash(), nil
}
func (self *Pipe) CompileMutan(code string) ([]byte, error) {
data, err := ethutil.Compile(code, false)
if err != nil {