diff options
author | Cayman Nava <caymannava@gmail.com> | 2014-09-07 04:51:13 +0800 |
---|---|---|
committer | Cayman Nava <caymannava@gmail.com> | 2014-09-10 12:27:34 +0800 |
commit | 7dacd7eb7818a336b3be99aea834093cf40a1b08 (patch) | |
tree | d2dcc8e7832a3e2c167c064195a3590fc7f43db1 /ethpipe/pipe.go | |
parent | 6afc16399f9624663579ad72950b4ea3b887db57 (diff) | |
download | dexon-7dacd7eb7818a336b3be99aea834093cf40a1b08.tar.gz dexon-7dacd7eb7818a336b3be99aea834093cf40a1b08.tar.zst dexon-7dacd7eb7818a336b3be99aea834093cf40a1b08.zip |
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.
Diffstat (limited to 'ethpipe/pipe.go')
-rw-r--r-- | ethpipe/pipe.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/ethpipe/pipe.go b/ethpipe/pipe.go index 800a71139..b7d3be041 100644 --- a/ethpipe/pipe.go +++ b/ethpipe/pipe.go @@ -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 { |