Prefer all caps for initialisms and acronyms
This commit is contained in:
@@ -46,7 +46,7 @@ func NewDB(databaseConfig config.Database, node core.Node) (*DB, error) {
|
||||
}
|
||||
|
||||
func (db *DB) CreateNode(node *core.Node) error {
|
||||
var nodeId int64
|
||||
var nodeID int64
|
||||
err := db.QueryRow(
|
||||
`INSERT INTO eth_nodes (genesis_block, network_id, eth_node_id, client_name)
|
||||
VALUES ($1, $2, $3, $4)
|
||||
@@ -57,10 +57,10 @@ func (db *DB) CreateNode(node *core.Node) error {
|
||||
eth_node_id = $3,
|
||||
client_name = $4
|
||||
RETURNING id`,
|
||||
node.GenesisBlock, node.NetworkID, node.ID, node.ClientName).Scan(&nodeId)
|
||||
node.GenesisBlock, node.NetworkID, node.ID, node.ClientName).Scan(&nodeID)
|
||||
if err != nil {
|
||||
return ErrUnableToSetNode(err)
|
||||
}
|
||||
db.NodeID = nodeId
|
||||
db.NodeID = nodeID
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ func (blockRepository BlockRepository) SetBlocksStatus(chainHead int64) error {
|
||||
|
||||
func (blockRepository BlockRepository) CreateOrUpdateBlock(block core.Block) (int64, error) {
|
||||
var err error
|
||||
var blockId int64
|
||||
var blockID int64
|
||||
retrievedBlockHash, ok := blockRepository.getBlockHash(block)
|
||||
if !ok {
|
||||
return blockRepository.insertBlock(block)
|
||||
@@ -64,10 +64,10 @@ func (blockRepository BlockRepository) CreateOrUpdateBlock(block core.Block) (in
|
||||
}
|
||||
return blockRepository.insertBlock(block)
|
||||
}
|
||||
return blockId, ErrBlockExists
|
||||
return blockID, ErrBlockExists
|
||||
}
|
||||
|
||||
func (blockRepository BlockRepository) MissingBlockNumbers(startingBlockNumber int64, highestBlockNumber int64, nodeId string) []int64 {
|
||||
func (blockRepository BlockRepository) MissingBlockNumbers(startingBlockNumber int64, highestBlockNumber int64, nodeID string) []int64 {
|
||||
numbers := make([]int64, 0)
|
||||
err := blockRepository.database.Select(&numbers,
|
||||
`SELECT all_block_numbers
|
||||
@@ -77,7 +77,7 @@ func (blockRepository BlockRepository) MissingBlockNumbers(startingBlockNumber i
|
||||
SELECT number FROM blocks WHERE eth_node_fingerprint = $3
|
||||
) `,
|
||||
startingBlockNumber,
|
||||
highestBlockNumber, nodeId)
|
||||
highestBlockNumber, nodeID)
|
||||
if err != nil {
|
||||
logrus.Error("MissingBlockNumbers: error getting blocks: ", err)
|
||||
}
|
||||
@@ -118,7 +118,7 @@ func (blockRepository BlockRepository) GetBlock(blockNumber int64) (core.Block,
|
||||
}
|
||||
|
||||
func (blockRepository BlockRepository) insertBlock(block core.Block) (int64, error) {
|
||||
var blockId int64
|
||||
var blockID int64
|
||||
tx, beginErr := blockRepository.database.Beginx()
|
||||
if beginErr != nil {
|
||||
return 0, postgres.ErrBeginTransactionFailed(beginErr)
|
||||
@@ -145,7 +145,7 @@ func (blockRepository BlockRepository) insertBlock(block core.Block) (int64, err
|
||||
nullStringToZero(block.Reward),
|
||||
nullStringToZero(block.UnclesReward),
|
||||
blockRepository.database.Node.ID).
|
||||
Scan(&blockId)
|
||||
Scan(&blockID)
|
||||
if insertBlockErr != nil {
|
||||
rollbackErr := tx.Rollback()
|
||||
if rollbackErr != nil {
|
||||
@@ -154,14 +154,14 @@ func (blockRepository BlockRepository) insertBlock(block core.Block) (int64, err
|
||||
return 0, postgres.ErrDBInsertFailed(insertBlockErr)
|
||||
}
|
||||
if len(block.Uncles) > 0 {
|
||||
insertUncleErr := blockRepository.createUncles(tx, blockId, block.Hash, block.Uncles)
|
||||
insertUncleErr := blockRepository.createUncles(tx, blockID, block.Hash, block.Uncles)
|
||||
if insertUncleErr != nil {
|
||||
tx.Rollback()
|
||||
return 0, postgres.ErrDBInsertFailed(insertUncleErr)
|
||||
}
|
||||
}
|
||||
if len(block.Transactions) > 0 {
|
||||
insertTxErr := blockRepository.createTransactions(tx, blockId, block.Transactions)
|
||||
insertTxErr := blockRepository.createTransactions(tx, blockID, block.Transactions)
|
||||
if insertTxErr != nil {
|
||||
rollbackErr := tx.Rollback()
|
||||
if rollbackErr != nil {
|
||||
@@ -178,12 +178,12 @@ func (blockRepository BlockRepository) insertBlock(block core.Block) (int64, err
|
||||
}
|
||||
return 0, commitErr
|
||||
}
|
||||
return blockId, nil
|
||||
return blockID, nil
|
||||
}
|
||||
|
||||
func (blockRepository BlockRepository) createUncles(tx *sqlx.Tx, blockId int64, blockHash string, uncles []core.Uncle) error {
|
||||
func (blockRepository BlockRepository) createUncles(tx *sqlx.Tx, blockID int64, blockHash string, uncles []core.Uncle) error {
|
||||
for _, uncle := range uncles {
|
||||
err := blockRepository.createUncle(tx, blockId, uncle)
|
||||
err := blockRepository.createUncle(tx, blockID, uncle)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -191,19 +191,19 @@ func (blockRepository BlockRepository) createUncles(tx *sqlx.Tx, blockId int64,
|
||||
return nil
|
||||
}
|
||||
|
||||
func (blockRepository BlockRepository) createUncle(tx *sqlx.Tx, blockId int64, uncle core.Uncle) error {
|
||||
func (blockRepository BlockRepository) createUncle(tx *sqlx.Tx, blockID int64, uncle core.Uncle) error {
|
||||
_, err := tx.Exec(
|
||||
`INSERT INTO uncles
|
||||
(hash, block_id, reward, miner, raw, block_timestamp, eth_node_id, eth_node_fingerprint)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7::NUMERIC, $8)
|
||||
RETURNING id`,
|
||||
uncle.Hash, blockId, nullStringToZero(uncle.Reward), uncle.Miner, uncle.Raw, uncle.Timestamp, blockRepository.database.NodeID, blockRepository.database.Node.ID)
|
||||
uncle.Hash, blockID, nullStringToZero(uncle.Reward), uncle.Miner, uncle.Raw, uncle.Timestamp, blockRepository.database.NodeID, blockRepository.database.Node.ID)
|
||||
return err
|
||||
}
|
||||
|
||||
func (blockRepository BlockRepository) createTransactions(tx *sqlx.Tx, blockId int64, transactions []core.TransactionModel) error {
|
||||
func (blockRepository BlockRepository) createTransactions(tx *sqlx.Tx, blockID int64, transactions []core.TransactionModel) error {
|
||||
for _, transaction := range transactions {
|
||||
err := blockRepository.createTransaction(tx, blockId, transaction)
|
||||
err := blockRepository.createTransaction(tx, blockID, transaction)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -221,24 +221,24 @@ func nullStringToZero(s string) string {
|
||||
return s
|
||||
}
|
||||
|
||||
func (blockRepository BlockRepository) createTransaction(tx *sqlx.Tx, blockId int64, transaction core.TransactionModel) error {
|
||||
func (blockRepository BlockRepository) createTransaction(tx *sqlx.Tx, blockID int64, transaction core.TransactionModel) error {
|
||||
_, err := tx.Exec(
|
||||
`INSERT INTO full_sync_transactions
|
||||
(block_id, gas_limit, gas_price, hash, input_data, nonce, raw, tx_from, tx_index, tx_to, "value")
|
||||
VALUES ($1, $2::NUMERIC, $3::NUMERIC, $4, $5, $6::NUMERIC, $7, $8, $9::NUMERIC, $10, $11::NUMERIC)
|
||||
RETURNING id`, blockId, transaction.GasLimit, transaction.GasPrice, transaction.Hash, transaction.Data,
|
||||
RETURNING id`, blockID, transaction.GasLimit, transaction.GasPrice, transaction.Hash, transaction.Data,
|
||||
transaction.Nonce, transaction.Raw, transaction.From, transaction.TxIndex, transaction.To, nullStringToZero(transaction.Value))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if hasReceipt(transaction) {
|
||||
receiptRepo := FullSyncReceiptRepository{}
|
||||
receiptId, err := receiptRepo.CreateFullSyncReceiptInTx(blockId, transaction.Receipt, tx)
|
||||
receiptID, err := receiptRepo.CreateFullSyncReceiptInTx(blockID, transaction.Receipt, tx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if hasLogs(transaction) {
|
||||
err = blockRepository.createLogs(tx, transaction.Receipt.Logs, receiptId)
|
||||
err = blockRepository.createLogs(tx, transaction.Receipt.Logs, receiptID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -266,13 +266,13 @@ func (blockRepository BlockRepository) getBlockHash(block core.Block) (string, b
|
||||
return retrievedBlockHash, blockExists(retrievedBlockHash)
|
||||
}
|
||||
|
||||
func (blockRepository BlockRepository) createLogs(tx *sqlx.Tx, logs []core.FullSyncLog, receiptId int64) error {
|
||||
func (blockRepository BlockRepository) createLogs(tx *sqlx.Tx, logs []core.FullSyncLog, receiptID int64) error {
|
||||
for _, tlog := range logs {
|
||||
_, err := tx.Exec(
|
||||
`INSERT INTO full_sync_logs (block_number, address, tx_hash, index, topic0, topic1, topic2, topic3, data, receipt_id)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
|
||||
`,
|
||||
tlog.BlockNumber, tlog.Address, tlog.TxHash, tlog.Index, tlog.Topics[0], tlog.Topics[1], tlog.Topics[2], tlog.Topics[3], tlog.Data, receiptId,
|
||||
tlog.BlockNumber, tlog.Address, tlog.TxHash, tlog.Index, tlog.Topics[0], tlog.Topics[1], tlog.Topics[2], tlog.Topics[3], tlog.Data, receiptID,
|
||||
)
|
||||
if err != nil {
|
||||
return postgres.ErrDBInsertFailed(err)
|
||||
|
||||
@@ -27,14 +27,14 @@ type FullSyncLogRepository struct {
|
||||
*postgres.DB
|
||||
}
|
||||
|
||||
func (repository FullSyncLogRepository) CreateLogs(lgs []core.FullSyncLog, receiptId int64) error {
|
||||
func (repository FullSyncLogRepository) CreateLogs(lgs []core.FullSyncLog, receiptID int64) error {
|
||||
tx, _ := repository.DB.Beginx()
|
||||
for _, tlog := range lgs {
|
||||
_, insertLogErr := tx.Exec(
|
||||
`INSERT INTO full_sync_logs (block_number, address, tx_hash, index, topic0, topic1, topic2, topic3, data, receipt_id)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
|
||||
`,
|
||||
tlog.BlockNumber, tlog.Address, tlog.TxHash, tlog.Index, tlog.Topics[0], tlog.Topics[1], tlog.Topics[2], tlog.Topics[3], tlog.Data, receiptId,
|
||||
tlog.BlockNumber, tlog.Address, tlog.TxHash, tlog.Index, tlog.Topics[0], tlog.Topics[1], tlog.Topics[2], tlog.Topics[3], tlog.Data, receiptID,
|
||||
)
|
||||
if insertLogErr != nil {
|
||||
rollbackErr := tx.Rollback()
|
||||
|
||||
@@ -30,19 +30,19 @@ type FullSyncReceiptRepository struct {
|
||||
*postgres.DB
|
||||
}
|
||||
|
||||
func (receiptRepository FullSyncReceiptRepository) CreateReceiptsAndLogs(blockId int64, receipts []core.Receipt) error {
|
||||
func (receiptRepository FullSyncReceiptRepository) CreateReceiptsAndLogs(blockID int64, receipts []core.Receipt) error {
|
||||
tx, err := receiptRepository.DB.Beginx()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
for _, receipt := range receipts {
|
||||
receiptId, err := receiptRepository.CreateFullSyncReceiptInTx(blockId, receipt, tx)
|
||||
receiptID, err := receiptRepository.CreateFullSyncReceiptInTx(blockID, receipt, tx)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
}
|
||||
if len(receipt.Logs) > 0 {
|
||||
err = createLogs(receipt.Logs, receiptId, tx)
|
||||
err = createLogs(receipt.Logs, receiptID, tx)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
return err
|
||||
@@ -53,28 +53,28 @@ func (receiptRepository FullSyncReceiptRepository) CreateReceiptsAndLogs(blockId
|
||||
return nil
|
||||
}
|
||||
|
||||
func createReceipt(receipt core.Receipt, blockId int64, tx *sqlx.Tx) (int64, error) {
|
||||
var receiptId int64
|
||||
func createReceipt(receipt core.Receipt, blockID int64, tx *sqlx.Tx) (int64, error) {
|
||||
var receiptID int64
|
||||
err := tx.QueryRow(
|
||||
`INSERT INTO full_sync_receipts
|
||||
(contract_address, tx_hash, cumulative_gas_used, gas_used, state_root, status, block_id)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7)
|
||||
RETURNING id`,
|
||||
receipt.ContractAddress, receipt.TxHash, receipt.CumulativeGasUsed, receipt.GasUsed, receipt.StateRoot, receipt.Status, blockId,
|
||||
).Scan(&receiptId)
|
||||
receipt.ContractAddress, receipt.TxHash, receipt.CumulativeGasUsed, receipt.GasUsed, receipt.StateRoot, receipt.Status, blockID,
|
||||
).Scan(&receiptID)
|
||||
if err != nil {
|
||||
logrus.Error("createReceipt: Error inserting: ", err)
|
||||
}
|
||||
return receiptId, err
|
||||
return receiptID, err
|
||||
}
|
||||
|
||||
func createLogs(logs []core.FullSyncLog, receiptId int64, tx *sqlx.Tx) error {
|
||||
func createLogs(logs []core.FullSyncLog, receiptID int64, tx *sqlx.Tx) error {
|
||||
for _, log := range logs {
|
||||
_, err := tx.Exec(
|
||||
`INSERT INTO full_sync_logs (block_number, address, tx_hash, index, topic0, topic1, topic2, topic3, data, receipt_id)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
|
||||
`,
|
||||
log.BlockNumber, log.Address, log.TxHash, log.Index, log.Topics[0], log.Topics[1], log.Topics[2], log.Topics[3], log.Data, receiptId,
|
||||
log.BlockNumber, log.Address, log.TxHash, log.Index, log.Topics[0], log.Topics[1], log.Topics[2], log.Topics[3], log.Data, receiptID,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -83,25 +83,25 @@ func createLogs(logs []core.FullSyncLog, receiptId int64, tx *sqlx.Tx) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (FullSyncReceiptRepository) CreateFullSyncReceiptInTx(blockId int64, receipt core.Receipt, tx *sqlx.Tx) (int64, error) {
|
||||
var receiptId int64
|
||||
addressId, getAddressErr := repository.GetOrCreateAddressInTransaction(tx, receipt.ContractAddress)
|
||||
func (FullSyncReceiptRepository) CreateFullSyncReceiptInTx(blockID int64, receipt core.Receipt, tx *sqlx.Tx) (int64, error) {
|
||||
var receiptID int64
|
||||
addressID, getAddressErr := repository.GetOrCreateAddressInTransaction(tx, receipt.ContractAddress)
|
||||
if getAddressErr != nil {
|
||||
logrus.Error("createReceipt: Error getting address id: ", getAddressErr)
|
||||
return receiptId, getAddressErr
|
||||
return receiptID, getAddressErr
|
||||
}
|
||||
err := tx.QueryRow(
|
||||
`INSERT INTO full_sync_receipts
|
||||
(contract_address_id, tx_hash, cumulative_gas_used, gas_used, state_root, status, block_id)
|
||||
VALUES ($1, $2, $3, $4, $5, $6, $7)
|
||||
RETURNING id`,
|
||||
addressId, receipt.TxHash, receipt.CumulativeGasUsed, receipt.GasUsed, receipt.StateRoot, receipt.Status, blockId).Scan(&receiptId)
|
||||
addressID, receipt.TxHash, receipt.CumulativeGasUsed, receipt.GasUsed, receipt.StateRoot, receipt.Status, blockID).Scan(&receiptID)
|
||||
if err != nil {
|
||||
tx.Rollback()
|
||||
logrus.Warning("CreateReceipt: error inserting receipt: ", err)
|
||||
return receiptId, err
|
||||
return receiptID, err
|
||||
}
|
||||
return receiptId, nil
|
||||
return receiptID, nil
|
||||
}
|
||||
|
||||
func (receiptRepository FullSyncReceiptRepository) GetFullSyncReceipt(txHash string) (core.Receipt, error) {
|
||||
|
||||
@@ -68,7 +68,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
|
||||
var txID int64
|
||||
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)
|
||||
@@ -77,12 +77,12 @@ func (repository HeaderRepository) CreateTransactionInTx(tx *sqlx.Tx, headerID i
|
||||
RETURNING id`,
|
||||
headerID, transaction.Hash, transaction.GasLimit, transaction.GasPrice,
|
||||
transaction.Data, transaction.Nonce, transaction.Raw, transaction.From,
|
||||
transaction.TxIndex, transaction.To, transaction.Value).Scan(&txId)
|
||||
transaction.TxIndex, transaction.To, transaction.Value).Scan(&txID)
|
||||
if err != nil {
|
||||
log.Error("header_repository: error inserting transaction: ", err)
|
||||
return txId, err
|
||||
return txID, err
|
||||
}
|
||||
return txId, err
|
||||
return txID, err
|
||||
}
|
||||
|
||||
func (repository HeaderRepository) GetHeader(blockNumber int64) (core.Header, error) {
|
||||
@@ -132,19 +132,19 @@ func (repository HeaderRepository) getHeaderHash(header core.Header) (string, er
|
||||
// Can happen when concurrent processes are inserting headers
|
||||
// Otherwise should not occur since only called in CreateOrUpdateHeader
|
||||
func (repository HeaderRepository) InternalInsertHeader(header core.Header) (int64, error) {
|
||||
var headerId int64
|
||||
var headerID int64
|
||||
row := repository.database.QueryRowx(
|
||||
`INSERT INTO public.headers (block_number, hash, block_timestamp, raw, eth_node_id, eth_node_fingerprint)
|
||||
VALUES ($1, $2, $3::NUMERIC, $4, $5, $6) ON CONFLICT DO NOTHING RETURNING id`,
|
||||
header.BlockNumber, header.Hash, header.Timestamp, header.Raw, repository.database.NodeID, repository.database.Node.ID)
|
||||
err := row.Scan(&headerId)
|
||||
err := row.Scan(&headerID)
|
||||
if err != nil {
|
||||
if err == sql.ErrNoRows {
|
||||
return 0, ErrValidHeaderExists
|
||||
}
|
||||
log.Error("InternalInsertHeader: error inserting header: ", err)
|
||||
}
|
||||
return headerId, err
|
||||
return headerID, err
|
||||
}
|
||||
|
||||
func (repository HeaderRepository) replaceHeader(header core.Header) (int64, error) {
|
||||
|
||||
@@ -423,7 +423,7 @@ var _ = Describe("Block header repository", func() {
|
||||
dbHeader, err := repo.GetHeader(header.BlockNumber)
|
||||
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
Expect(dbHeader.Id).NotTo(BeZero())
|
||||
Expect(dbHeader.ID).NotTo(BeZero())
|
||||
Expect(dbHeader.BlockNumber).To(Equal(header.BlockNumber))
|
||||
Expect(dbHeader.Hash).To(Equal(header.Hash))
|
||||
Expect(dbHeader.Raw).To(MatchJSON(header.Raw))
|
||||
|
||||
@@ -73,7 +73,7 @@ func (repo HeaderSyncLogRepository) GetUntransformedHeaderSyncLogs() ([]core.Hea
|
||||
for _, topic := range rawLog.Topics {
|
||||
logTopics = append(logTopics, common.BytesToHash(topic))
|
||||
}
|
||||
address, addrErr := repository.GetAddressById(repo.db, rawLog.Address)
|
||||
address, addrErr := repository.GetAddressByID(repo.db, rawLog.Address)
|
||||
if addrErr != nil {
|
||||
return nil, addrErr
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ var _ = Describe("Header sync log repository", func() {
|
||||
Expect(lookupErr).NotTo(HaveOccurred())
|
||||
Expect(dbLog.ID).NotTo(BeZero())
|
||||
Expect(dbLog.HeaderID).To(Equal(headerID))
|
||||
actualAddress, addressErr := repository2.GetAddressById(db, dbLog.Address)
|
||||
actualAddress, addressErr := repository2.GetAddressByID(db, dbLog.Address)
|
||||
Expect(addressErr).NotTo(HaveOccurred())
|
||||
Expect(actualAddress).To(Equal(log.Address.Hex()))
|
||||
Expect(dbLog.Topics[0]).To(Equal(log.Topics[0].Bytes()))
|
||||
@@ -128,7 +128,7 @@ var _ = Describe("Header sync log repository", func() {
|
||||
logTopics = append(logTopics, common.BytesToHash(topic))
|
||||
}
|
||||
|
||||
actualAddress, addressErr := repository2.GetAddressById(db, dbLog.Address)
|
||||
actualAddress, addressErr := repository2.GetAddressByID(db, dbLog.Address)
|
||||
Expect(addressErr).NotTo(HaveOccurred())
|
||||
reconstructedLog := types.Log{
|
||||
Address: common.HexToAddress(actualAddress),
|
||||
|
||||
@@ -26,11 +26,11 @@ import (
|
||||
type HeaderSyncReceiptRepository struct{}
|
||||
|
||||
func (HeaderSyncReceiptRepository) CreateHeaderSyncReceiptInTx(headerID, transactionID int64, receipt core.Receipt, tx *sqlx.Tx) (int64, error) {
|
||||
var receiptId int64
|
||||
addressId, getAddressErr := repository.GetOrCreateAddressInTransaction(tx, receipt.ContractAddress)
|
||||
var receiptID int64
|
||||
addressID, getAddressErr := repository.GetOrCreateAddressInTransaction(tx, receipt.ContractAddress)
|
||||
if getAddressErr != nil {
|
||||
log.Error("createReceipt: Error getting address id: ", getAddressErr)
|
||||
return receiptId, getAddressErr
|
||||
return receiptID, getAddressErr
|
||||
}
|
||||
err := tx.QueryRowx(`INSERT INTO public.header_sync_receipts
|
||||
(header_id, transaction_id, contract_address_id, cumulative_gas_used, gas_used, state_root, status, tx_hash, rlp)
|
||||
@@ -38,10 +38,10 @@ func (HeaderSyncReceiptRepository) CreateHeaderSyncReceiptInTx(headerID, transac
|
||||
ON CONFLICT (header_id, transaction_id) DO UPDATE
|
||||
SET (contract_address_id, cumulative_gas_used, gas_used, state_root, status, tx_hash, rlp) = ($3, $4::NUMERIC, $5::NUMERIC, $6, $7, $8, $9)
|
||||
RETURNING id`,
|
||||
headerID, transactionID, addressId, receipt.CumulativeGasUsed, receipt.GasUsed, receipt.StateRoot, receipt.Status, receipt.TxHash, receipt.Rlp).Scan(&receiptId)
|
||||
headerID, transactionID, addressID, receipt.CumulativeGasUsed, receipt.GasUsed, receipt.StateRoot, receipt.Status, receipt.TxHash, receipt.Rlp).Scan(&receiptID)
|
||||
if err != nil {
|
||||
log.Error("header_repository: error inserting receipt: ", err)
|
||||
return receiptId, err
|
||||
return receiptID, err
|
||||
}
|
||||
return receiptId, err
|
||||
return receiptID, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user