@@ -1151,7 +1151,6 @@ func (core *coreService) actionsInBlock(blk *block.Block, start, count uint64) [
1151
1151
h := blk .HashBlock ()
1152
1152
blkHash := hex .EncodeToString (h [:])
1153
1153
blkHeight := blk .Height ()
1154
- ts := blk .Header .BlockHeaderCoreProto ().Timestamp
1155
1154
1156
1155
lastAction := start + count
1157
1156
if count == math .MaxUint64 {
@@ -1169,14 +1168,21 @@ func (core *coreService) actionsInBlock(blk *block.Block, start, count uint64) [
1169
1168
log .L ().Debug ("Skipping action due to hash error" , zap .Error (err ))
1170
1169
continue
1171
1170
}
1171
+ receipt , err := core .dao .GetReceiptByActionHash (actHash , blkHeight )
1172
+ if err != nil {
1173
+ log .L ().Debug ("Skipping action due to failing to get receipt" , zap .Error (err ))
1174
+ continue
1175
+ }
1176
+ gas := new (big.Int ).Mul (selp .GasPrice (), big .NewInt (int64 (receipt .GasConsumed )))
1172
1177
sender := selp .SrcPubkey ().Address ()
1173
1178
res = append (res , & iotexapi.ActionInfo {
1174
1179
Action : selp .Proto (),
1175
1180
ActHash : hex .EncodeToString (actHash [:]),
1176
1181
BlkHash : blkHash ,
1177
- Timestamp : ts ,
1182
+ Timestamp : blk . Header . BlockHeaderCoreProto (). Timestamp ,
1178
1183
BlkHeight : blkHeight ,
1179
1184
Sender : sender .String (),
1185
+ GasFee : gas .String (),
1180
1186
Index : uint32 (i ),
1181
1187
})
1182
1188
}
@@ -1187,7 +1193,6 @@ func (core *coreService) reverseActionsInBlock(blk *block.Block, reverseStart, c
1187
1193
h := blk .HashBlock ()
1188
1194
blkHash := hex .EncodeToString (h [:])
1189
1195
blkHeight := blk .Height ()
1190
- ts := blk .Header .BlockHeaderCoreProto ().Timestamp
1191
1196
1192
1197
var res []* iotexapi.ActionInfo
1193
1198
for i := reverseStart ; i < uint64 (len (blk .Actions )) && i < reverseStart + count ; i ++ {
@@ -1198,14 +1203,21 @@ func (core *coreService) reverseActionsInBlock(blk *block.Block, reverseStart, c
1198
1203
log .L ().Debug ("Skipping action due to hash error" , zap .Error (err ))
1199
1204
continue
1200
1205
}
1206
+ receipt , err := core .dao .GetReceiptByActionHash (actHash , blkHeight )
1207
+ if err != nil {
1208
+ log .L ().Debug ("Skipping action due to failing to get receipt" , zap .Error (err ))
1209
+ continue
1210
+ }
1211
+ gas := new (big.Int ).Mul (selp .GasPrice (), big .NewInt (int64 (receipt .GasConsumed )))
1201
1212
sender := selp .SrcPubkey ().Address ()
1202
1213
res = append ([]* iotexapi.ActionInfo {{
1203
1214
Action : selp .Proto (),
1204
1215
ActHash : hex .EncodeToString (actHash [:]),
1205
1216
BlkHash : blkHash ,
1206
- Timestamp : ts ,
1217
+ Timestamp : blk . Header . BlockHeaderCoreProto (). Timestamp ,
1207
1218
BlkHeight : blkHeight ,
1208
1219
Sender : sender .String (),
1220
+ GasFee : gas .String (),
1209
1221
Index : uint32 (ri ),
1210
1222
}}, res ... )
1211
1223
}
0 commit comments