diff options
author | obscuren <geffobscura@gmail.com> | 2014-05-09 00:26:46 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2014-05-09 00:26:46 +0800 |
commit | d709815106824a3469b5f4152fd32705d7d142d4 (patch) | |
tree | db68e4b228f0a46e73a0ca841beacf87e92a68af /ethpub | |
parent | f0440e85dc306f270666e3aee1fe419b684a2ae8 (diff) | |
download | dexon-d709815106824a3469b5f4152fd32705d7d142d4.tar.gz dexon-d709815106824a3469b5f4152fd32705d7d142d4.tar.zst dexon-d709815106824a3469b5f4152fd32705d7d142d4.zip |
Added trans state and removed watch address etc
The transient state can be used to test out changes before committing
them to the proc state. The transient state is currently being used by
the gui to support proper nonce updating without having to wait for a
block. This used to be done by a cached state mechanism which can now
safely by removed.
Diffstat (limited to 'ethpub')
-rw-r--r-- | ethpub/pub.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/ethpub/pub.go b/ethpub/pub.go index 5e7792a9f..f7e641b35 100644 --- a/ethpub/pub.go +++ b/ethpub/pub.go @@ -92,7 +92,14 @@ func (lib *PEthereum) createTx(key, recipient, valueStr, gasStr, gasPriceStr, in hash = ethutil.FromHex(recipient) } - keyPair, err := ethchain.NewKeyPairFromSec([]byte(ethutil.FromHex(key))) + var keyPair *ethchain.KeyPair + var err error + if key[0:2] == "0x" { + keyPair, err = ethchain.NewKeyPairFromSec([]byte(ethutil.FromHex(key[0:2]))) + } else { + keyPair, err = ethchain.NewKeyPairFromSec([]byte(ethutil.FromHex(key))) + } + if err != nil { return nil, err } @@ -132,8 +139,11 @@ func (lib *PEthereum) createTx(key, recipient, valueStr, gasStr, gasPriceStr, in tx = ethchain.NewTransactionMessage(hash, value, gas, gasPrice, ethutil.FromHex(initStr)) } - acc := lib.stateManager.GetAddrState(keyPair.Address()) + acc := lib.stateManager.TransState().GetStateObject(keyPair.Address()) + //acc := lib.stateManager.GetAddrState(keyPair.Address()) tx.Nonce = acc.Nonce + lib.stateManager.TransState().SetStateObject(acc) + tx.Sign(keyPair.PrivateKey) lib.txPool.QueueTransaction(tx) |