iotex-core
iotex-core copied to clipboard
improve Actions(start uint64, count uint64)
What would you like to be added:
it collects action in reverse direction, see func (core *coreService) reverseActionsInBlock
, in there a new slice is always allocated and existing slice appended after the new slice
res = append([]*iotexapi.ActionInfo{{
Action: selp.Proto(),
ActHash: hex.EncodeToString(actHash[:]),
BlkHash: blkHash,
Timestamp: blk.Header.BlockHeaderCoreProto().Timestamp,
BlkHeight: blkHeight,
Sender: sender.String(),
GasFee: gas.String(),
Index: uint32(ri),
}}, res...)
Why is this needed: this is not efficient in both memory and running time, find a better solution to optimize it