forked from cerc-io/ipld-eth-server
Add tx fields
This commit is contained in:
@@ -44,15 +44,16 @@ func GethBlockToCoreBlock(gethBlock *types.Block, client GethClient) core.Block
|
||||
}
|
||||
|
||||
func gethTransToCoreTrans(transaction *types.Transaction, from *common.Address) core.Transaction {
|
||||
data := hexutil.Encode(transaction.Data())
|
||||
return core.Transaction{
|
||||
Hash: transaction.Hash().Hex(),
|
||||
Data: transaction.Data(),
|
||||
Nonce: transaction.Nonce(),
|
||||
To: strings.ToLower(addressToHex(transaction.To())),
|
||||
From: strings.ToLower(addressToHex(from)),
|
||||
GasLimit: transaction.Gas().Int64(),
|
||||
GasPrice: transaction.GasPrice().Int64(),
|
||||
Value: transaction.Value().Int64(),
|
||||
Data: data,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -203,7 +203,8 @@ var _ = Describe("Conversion of GethBlock to core.Block", func() {
|
||||
amount := big.NewInt(10)
|
||||
gasLimit := big.NewInt(5000)
|
||||
gasPrice := big.NewInt(3)
|
||||
payload := []byte("1234")
|
||||
input := "0xf7d8c8830000000000000000000000000000000000000000000000000000000000037788000000000000000000000000000000000000000000000000000000000003bd14"
|
||||
payload, _ := hexutil.Decode(input)
|
||||
|
||||
gethTransaction := types.NewTransaction(nonce, to, amount, gasLimit, gasPrice, payload)
|
||||
|
||||
@@ -214,7 +215,7 @@ var _ = Describe("Conversion of GethBlock to core.Block", func() {
|
||||
|
||||
Expect(len(coreBlock.Transactions)).To(Equal(1))
|
||||
coreTransaction := coreBlock.Transactions[0]
|
||||
Expect(coreTransaction.Data).To(Equal(gethTransaction.Data()))
|
||||
Expect(coreTransaction.Data).To(Equal(input))
|
||||
Expect(coreTransaction.To).To(Equal(gethTransaction.To().Hex()))
|
||||
Expect(coreTransaction.From).To(Equal("0x0000000000000000000000000000000000000123"))
|
||||
Expect(coreTransaction.GasLimit).To(Equal(gethTransaction.Gas().Int64()))
|
||||
|
||||
Reference in New Issue
Block a user