forked from cerc-io/ipld-eth-server
Rename transactions to full_sync_transactions
- Table has foreign key to blocks - Add transaction RLP and transaction index to table - Enables other tables with standalone transactions or transactions associated with other data structures (e.g. headers)
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
package fakes
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"strconv"
|
||||
@@ -48,3 +49,42 @@ func GetFakeHeader(blockNumber int64) core.Header {
|
||||
Timestamp: strconv.FormatInt(fakeTimestamp, 10),
|
||||
}
|
||||
}
|
||||
|
||||
var fakeTransaction types.Transaction
|
||||
var rawTransaction bytes.Buffer
|
||||
var _ = fakeTransaction.EncodeRLP(&rawTransaction)
|
||||
var FakeTransaction = core.Transaction{
|
||||
Data: "",
|
||||
From: "",
|
||||
GasLimit: 0,
|
||||
GasPrice: 0,
|
||||
Hash: "",
|
||||
Nonce: 0,
|
||||
Raw: rawTransaction.Bytes(),
|
||||
Receipt: core.Receipt{},
|
||||
To: "",
|
||||
TxIndex: 0,
|
||||
Value: "0",
|
||||
}
|
||||
|
||||
func GetFakeTransaction(hash string, receipt core.Receipt) core.Transaction {
|
||||
gethTransaction := types.Transaction{}
|
||||
var raw bytes.Buffer
|
||||
err := gethTransaction.EncodeRLP(&raw)
|
||||
if err != nil {
|
||||
panic("failed to marshal transaction creating test fake")
|
||||
}
|
||||
return core.Transaction{
|
||||
Data: "",
|
||||
From: "",
|
||||
GasLimit: 0,
|
||||
GasPrice: 0,
|
||||
Hash: hash,
|
||||
Nonce: 0,
|
||||
Raw: raw.Bytes(),
|
||||
Receipt: receipt,
|
||||
To: "",
|
||||
TxIndex: 0,
|
||||
Value: "0",
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user