Created generic message (easy for testing)

This commit is contained in:
obscuren
2014-12-18 15:18:13 +01:00
parent 9e286e1c33
commit db494170dc
10 changed files with 159 additions and 102 deletions

View File

@ -97,21 +97,21 @@ type JSTransaction struct {
func NewJSTx(tx *types.Transaction, state *state.StateDB) *JSTransaction {
hash := ethutil.Bytes2Hex(tx.Hash())
receiver := ethutil.Bytes2Hex(tx.Recipient)
receiver := ethutil.Bytes2Hex(tx.To())
if receiver == "0000000000000000000000000000000000000000" {
receiver = ethutil.Bytes2Hex(tx.CreationAddress(state))
receiver = ethutil.Bytes2Hex(core.AddressFromMessage(tx))
}
sender := ethutil.Bytes2Hex(tx.Sender())
createsContract := tx.CreatesContract()
var data string
if tx.CreatesContract() {
data = strings.Join(core.Disassemble(tx.Data), "\n")
data = strings.Join(core.Disassemble(tx.Data()), "\n")
} else {
data = ethutil.Bytes2Hex(tx.Data)
data = ethutil.Bytes2Hex(tx.Data())
}
return &JSTransaction{ref: tx, Hash: hash, Value: ethutil.CurrencyToString(tx.Value), Address: receiver, Contract: tx.CreatesContract(), Gas: tx.Gas.String(), GasPrice: tx.GasPrice.String(), Data: data, Sender: sender, CreatesContract: createsContract, RawData: ethutil.Bytes2Hex(tx.Data)}
return &JSTransaction{ref: tx, Hash: hash, Value: ethutil.CurrencyToString(tx.Value()), Address: receiver, Contract: tx.CreatesContract(), Gas: tx.Gas().String(), GasPrice: tx.GasPrice().String(), Data: data, Sender: sender, CreatesContract: createsContract, RawData: ethutil.Bytes2Hex(tx.Data())}
}
func (self *JSTransaction) ToString() string {