(VDB-560) Rename lightSync to headerSync
This commit is contained in:
@@ -54,7 +54,7 @@ func (repository HeaderRepository) CreateOrUpdateHeader(header core.Header) (int
|
||||
|
||||
func (repository HeaderRepository) CreateTransactions(headerID int64, transactions []core.TransactionModel) error {
|
||||
for _, transaction := range transactions {
|
||||
_, err := repository.database.Exec(`INSERT INTO public.light_sync_transactions
|
||||
_, err := repository.database.Exec(`INSERT INTO public.header_sync_transactions
|
||||
(header_id, hash, gas_limit, gas_price, input_data, nonce, raw, tx_from, tx_index, tx_to, "value")
|
||||
VALUES ($1, $2, $3::NUMERIC, $4::NUMERIC, $5, $6::NUMERIC, $7, $8, $9::NUMERIC, $10, $11::NUMERIC)
|
||||
ON CONFLICT DO NOTHING`, headerID, transaction.Hash, transaction.GasLimit, transaction.GasPrice,
|
||||
@@ -69,7 +69,7 @@ func (repository HeaderRepository) CreateTransactions(headerID int64, transactio
|
||||
|
||||
func (repository HeaderRepository) CreateTransactionInTx(tx *sqlx.Tx, headerID int64, transaction core.TransactionModel) (int64, error) {
|
||||
var txId int64
|
||||
err := tx.QueryRowx(`INSERT INTO public.light_sync_transactions
|
||||
err := tx.QueryRowx(`INSERT INTO public.header_sync_transactions
|
||||
(header_id, hash, gas_limit, gas_price, input_data, nonce, raw, tx_from, tx_index, tx_to, "value")
|
||||
VALUES ($1, $2, $3::NUMERIC, $4::NUMERIC, $5, $6::NUMERIC, $7, $8, $9::NUMERIC, $10, $11::NUMERIC)
|
||||
ON CONFLICT (header_id, hash) DO UPDATE
|
||||
@@ -87,7 +87,7 @@ func (repository HeaderRepository) CreateTransactionInTx(tx *sqlx.Tx, headerID i
|
||||
|
||||
func (repository HeaderRepository) CreateReceiptInTx(tx *sqlx.Tx, headerID, transactionID int64, receipt core.Receipt) (int64, error) {
|
||||
var receiptId int64
|
||||
err := tx.QueryRowx(`INSERT INTO public.light_sync_receipts
|
||||
err := tx.QueryRowx(`INSERT INTO public.header_sync_receipts
|
||||
(header_id, transaction_id, contract_address, cumulative_gas_used, gas_used, state_root, status, tx_hash, rlp)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)
|
||||
ON CONFLICT (header_id, transaction_id) DO UPDATE
|
||||
|
||||
@@ -228,7 +228,7 @@ var _ = Describe("Block header repository", func() {
|
||||
var dbReceipt idModel
|
||||
err = db.Get(&dbReceipt,
|
||||
`SELECT transaction_id, contract_address, cumulative_gas_used, gas_used, state_root, status, tx_hash, rlp
|
||||
FROM public.light_sync_receipts WHERE header_id = $1`, headerID)
|
||||
FROM public.header_sync_receipts WHERE header_id = $1`, headerID)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(dbReceipt.TransactionId).To(Equal(txId))
|
||||
Expect(dbReceipt.TxHash).To(Equal(txHash.Hex()))
|
||||
@@ -288,7 +288,7 @@ var _ = Describe("Block header repository", func() {
|
||||
var dbTransactions []core.TransactionModel
|
||||
err = db.Select(&dbTransactions,
|
||||
`SELECT hash, gas_limit, gas_price, input_data, nonce, raw, tx_from, tx_index, tx_to, "value"
|
||||
FROM public.light_sync_transactions WHERE header_id = $1`, headerID)
|
||||
FROM public.header_sync_transactions WHERE header_id = $1`, headerID)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(dbTransactions).To(ConsistOf(transactions))
|
||||
})
|
||||
@@ -300,7 +300,7 @@ var _ = Describe("Block header repository", func() {
|
||||
var dbTransactions []core.TransactionModel
|
||||
err = db.Select(&dbTransactions,
|
||||
`SELECT hash, gas_limit, gas_price, input_data, nonce, raw, tx_from, tx_index, tx_to, "value"
|
||||
FROM public.light_sync_transactions WHERE header_id = $1`, headerID)
|
||||
FROM public.header_sync_transactions WHERE header_id = $1`, headerID)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(len(dbTransactions)).To(Equal(2))
|
||||
})
|
||||
@@ -337,7 +337,7 @@ var _ = Describe("Block header repository", func() {
|
||||
var dbTransaction core.TransactionModel
|
||||
err = db.Get(&dbTransaction,
|
||||
`SELECT hash, gas_limit, gas_price, input_data, nonce, raw, tx_from, tx_index, tx_to, "value"
|
||||
FROM public.light_sync_transactions WHERE header_id = $1`, headerID)
|
||||
FROM public.header_sync_transactions WHERE header_id = $1`, headerID)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(dbTransaction).To(Equal(transaction))
|
||||
})
|
||||
@@ -381,7 +381,7 @@ var _ = Describe("Block header repository", func() {
|
||||
var dbTransactions []core.TransactionModel
|
||||
err = db.Select(&dbTransactions,
|
||||
`SELECT hash, gas_limit, gas_price, input_data, nonce, raw, tx_from, tx_index, tx_to, "value"
|
||||
FROM public.light_sync_transactions WHERE header_id = $1`, headerID)
|
||||
FROM public.header_sync_transactions WHERE header_id = $1`, headerID)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(len(dbTransactions)).To(Equal(1))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user