@@ -124,18 +124,14 @@ const (
124124 ipldInsert = "INSERT INTO public.blocks (key, data) VALUES ('%s', '\\ x%x');\n "
125125
126126 headerInsert = "INSERT INTO eth.header_cids (block_number, block_hash, parent_hash, cid, td, node_id, reward, " +
127- "state_root, tx_root, receipt_root, uncle_root, bloom, timestamp, mh_key, times_validated, base_fee) VALUES " +
128- "('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '\\ x%x', %d, '%s', %d, %s);\n "
129-
130- headerInsertWithoutBaseFee = "INSERT INTO eth.header_cids (block_number, block_hash, parent_hash, cid, td, node_id, " +
131- "reward, state_root, tx_root, receipt_root, uncle_root, bloom, timestamp, mh_key, times_validated, base_fee) VALUES " +
132- "('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '\\ x%x', %d, '%s', %d, NULL);\n "
127+ "state_root, tx_root, receipt_root, uncle_root, bloom, timestamp, mh_key, times_validated, coinbase) VALUES " +
128+ "('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '\\ x%x', %d, '%s', %d, '%s');\n "
133129
134130 uncleInsert = "INSERT INTO eth.uncle_cids (block_hash, header_id, parent_hash, cid, reward, mh_key) VALUES " +
135131 "('%s', '%s', '%s', '%s', '%s', '%s');\n "
136132
137- txInsert = "INSERT INTO eth.transaction_cids (header_id, tx_hash, cid, dst, src, index, mh_key, tx_data, tx_type) " +
138- "VALUES ('%s', '%s', '%s', '%s', '%s', %d, '%s', '\\ x%x', %d);\n "
133+ txInsert = "INSERT INTO eth.transaction_cids (header_id, tx_hash, cid, dst, src, index, mh_key, tx_data, tx_type, " +
134+ "value) VALUES ('%s', '%s', '%s', '%s', '%s', %d, '%s', '\\ x%x', %d, '%s' );\n "
139135
140136 alInsert = "INSERT INTO eth.access_list_elements (tx_id, index, address, storage_keys) VALUES ('%s', %d, '%s', '%s');\n "
141137
@@ -191,42 +187,40 @@ func (sqw *SQLWriter) upsertIPLDRaw(codec, mh uint64, raw []byte) (string, strin
191187}
192188
193189func (sqw * SQLWriter ) upsertHeaderCID (header models.HeaderModel ) {
194- var stmt string
195- if header .BaseFee == nil {
196- stmt = fmt .Sprintf (headerInsertWithoutBaseFee , header .BlockNumber , header .BlockHash , header .ParentHash , header .CID ,
197- header .TotalDifficulty , header .NodeID , header .Reward , header .StateRoot , header .TxRoot ,
198- header .RctRoot , header .UncleRoot , header .Bloom , header .Timestamp , header .MhKey , 1 )
199- } else {
200- stmt = fmt .Sprintf (headerInsert , header .BlockNumber , header .BlockHash , header .ParentHash , header .CID ,
201- header .TotalDifficulty , header .NodeID , header .Reward , header .StateRoot , header .TxRoot ,
202- header .RctRoot , header .UncleRoot , header .Bloom , header .Timestamp , header .MhKey , 1 , * header .BaseFee )
203- }
190+ stmt := fmt .Sprintf (headerInsert , header .BlockNumber , header .BlockHash , header .ParentHash , header .CID ,
191+ header .TotalDifficulty , header .NodeID , header .Reward , header .StateRoot , header .TxRoot ,
192+ header .RctRoot , header .UncleRoot , header .Bloom , header .Timestamp , header .MhKey , 1 , header .Coinbase )
204193 sqw .stmts <- []byte (stmt )
205194 indexerMetrics .blocks .Inc (1 )
206195}
207196
208197func (sqw * SQLWriter ) upsertUncleCID (uncle models.UncleModel ) {
209- sqw .stmts <- []byte (fmt .Sprintf (uncleInsert , uncle .BlockHash , uncle .HeaderID , uncle .ParentHash , uncle .CID , uncle .Reward , uncle .MhKey ))
198+ sqw .stmts <- []byte (fmt .Sprintf (uncleInsert , uncle .BlockHash , uncle .HeaderID , uncle .ParentHash , uncle .CID ,
199+ uncle .Reward , uncle .MhKey ))
210200}
211201
212202func (sqw * SQLWriter ) upsertTransactionCID (transaction models.TxModel ) {
213- sqw .stmts <- []byte (fmt .Sprintf (txInsert , transaction .HeaderID , transaction .TxHash , transaction .CID , transaction .Dst , transaction .Src , transaction .Index , transaction .MhKey , transaction .Data , transaction .Type ))
203+ sqw .stmts <- []byte (fmt .Sprintf (txInsert , transaction .HeaderID , transaction .TxHash , transaction .CID , transaction .Dst ,
204+ transaction .Src , transaction .Index , transaction .MhKey , transaction .Data , transaction .Type , transaction .Value ))
214205 indexerMetrics .transactions .Inc (1 )
215206}
216207
217208func (sqw * SQLWriter ) upsertAccessListElement (accessListElement models.AccessListElementModel ) {
218- sqw .stmts <- []byte (fmt .Sprintf (alInsert , accessListElement .TxID , accessListElement .Index , accessListElement .Address , formatPostgresStringArray (accessListElement .StorageKeys )))
209+ sqw .stmts <- []byte (fmt .Sprintf (alInsert , accessListElement .TxID , accessListElement .Index , accessListElement .Address ,
210+ formatPostgresStringArray (accessListElement .StorageKeys )))
219211 indexerMetrics .accessListEntries .Inc (1 )
220212}
221213
222214func (sqw * SQLWriter ) upsertReceiptCID (rct * models.ReceiptModel ) {
223- sqw .stmts <- []byte (fmt .Sprintf (rctInsert , rct .TxID , rct .LeafCID , rct .Contract , rct .ContractHash , rct .LeafMhKey , rct .PostState , rct .PostStatus , rct .LogRoot ))
215+ sqw .stmts <- []byte (fmt .Sprintf (rctInsert , rct .TxID , rct .LeafCID , rct .Contract , rct .ContractHash , rct .LeafMhKey ,
216+ rct .PostState , rct .PostStatus , rct .LogRoot ))
224217 indexerMetrics .receipts .Inc (1 )
225218}
226219
227220func (sqw * SQLWriter ) upsertLogCID (logs []* models.LogsModel ) {
228221 for _ , l := range logs {
229- sqw .stmts <- []byte (fmt .Sprintf (logInsert , l .LeafCID , l .LeafMhKey , l .ReceiptID , l .Address , l .Index , l .Topic0 , l .Topic1 , l .Topic2 , l .Topic3 , l .Data ))
222+ sqw .stmts <- []byte (fmt .Sprintf (logInsert , l .LeafCID , l .LeafMhKey , l .ReceiptID , l .Address , l .Index , l .Topic0 ,
223+ l .Topic1 , l .Topic2 , l .Topic3 , l .Data ))
230224 indexerMetrics .logs .Inc (1 )
231225 }
232226}
0 commit comments