@@ -28,7 +28,11 @@ func (api NetworkHandlerAPI) GetOperationsByTxHashHandler(w http.ResponseWriter,
2828 return
2929 }
3030
31- options := p .ListOptions ()
31+ options , err := p .PageCursorListOptions (block .GetBlockOperationKeyPrefixTxHash (hash ))
32+ if err != nil {
33+ httputils .WriteJSONError (w , err )
34+ return
35+ }
3236
3337 if httputils .IsEventStream (r ) {
3438 event := fmt .Sprintf ("txhash-%s" , hash )
@@ -41,24 +45,24 @@ func (api NetworkHandlerAPI) GetOperationsByTxHashHandler(w http.ResponseWriter,
4145 return
4246 }
4347
44- ops , cursor := api .getOperationsByTxHash (hash , options )
48+ ops , order := api .getOperationsByTxHash (hash , options )
4549 if len (ops ) < 1 {
4650 httputils .WriteJSONError (w , errors .BlockTransactionDoesNotExists )
4751 return
4852 }
4953
50- list := p .ResourceList (ops , cursor )
54+ list := p .ResourceListWithOrder (ops , order )
5155 httputils .MustWriteJSON (w , 200 , list )
5256}
5357
54- func (api NetworkHandlerAPI ) getOperationsByTxHash (txHash string , options storage.ListOptions ) (txs []resource.Resource , cursor [] byte ) {
58+ func (api NetworkHandlerAPI ) getOperationsByTxHash (txHash string , options storage.ListOptions ) (txs []resource.Resource , order * block. BlockOrder ) {
5559 iterFunc , closeFunc := block .GetBlockOperationsByTxHash (api .storage , txHash , options )
5660 for {
57- o , hasNext , c := iterFunc ()
58- cursor = c
61+ o , hasNext , _ := iterFunc ()
5962 if ! hasNext {
6063 break
6164 }
65+ order = o .BlockOrder ()
6266 txs = append (txs , resource .NewOperation (& o ))
6367 }
6468 closeFunc ()
0 commit comments