Commit 38b4dc2c authored by Jeffrey Wilcke's avatar Jeffrey Wilcke

Merge pull request #21 from nicksavers/patch-1

Rearrange transaction RLP encoding...
parents fafdd21e 530ab6b8
...@@ -109,10 +109,10 @@ func (tx *Transaction) Sign(privk []byte) error { ...@@ -109,10 +109,10 @@ func (tx *Transaction) Sign(privk []byte) error {
return nil return nil
} }
// [ NONCE, VALUE, GASPRICE, GAS, TO, DATA, V, R, S ] // [ NONCE, GASPRICE, GAS, TO, VALUE, DATA, V, R, S ]
// [ NONCE, VALUE, GASPRICE, GAS, 0, CODE, INIT, V, R, S ] // [ NONCE, GASPRICE, GAS, 0, VALUE, CODE, INIT, V, R, S ]
func (tx *Transaction) RlpData() interface{} { func (tx *Transaction) RlpData() interface{} {
data := []interface{}{tx.Nonce, tx.Value, tx.GasPrice, tx.Gas, tx.Recipient, tx.Data} data := []interface{}{tx.Nonce, tx.GasPrice, tx.Gas, tx.Recipient, tx.Value, tx.Data}
if tx.contractCreation { if tx.contractCreation {
data = append(data, tx.Init) data = append(data, tx.Init)
...@@ -135,10 +135,10 @@ func (tx *Transaction) RlpDecode(data []byte) { ...@@ -135,10 +135,10 @@ func (tx *Transaction) RlpDecode(data []byte) {
func (tx *Transaction) RlpValueDecode(decoder *ethutil.Value) { func (tx *Transaction) RlpValueDecode(decoder *ethutil.Value) {
tx.Nonce = decoder.Get(0).Uint() tx.Nonce = decoder.Get(0).Uint()
tx.Value = decoder.Get(1).BigInt() tx.GasPrice = decoder.Get(1).BigInt()
tx.GasPrice = decoder.Get(2).BigInt() tx.Gas = decoder.Get(2).BigInt()
tx.Gas = decoder.Get(3).BigInt() tx.Recipient = decoder.Get(3).Bytes()
tx.Recipient = decoder.Get(4).Bytes() tx.Value = decoder.Get(4).BigInt()
tx.Data = decoder.Get(5).Bytes() tx.Data = decoder.Get(5).Bytes()
// If the list is of length 10 it's a contract creation tx // If the list is of length 10 it's a contract creation tx
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment