Page MenuHomePhabricator

Merge #17746: refactor: rpc: Remove vector copy from listtransactions
ClosedPublic

Authored by jasonbcox on Jul 14 2020, 18:06.

Details

Summary

25bc17fceb08ee9625c5e09e2579117ec6f7a1c5 refactor: rpc: Remove vector copy from listtransactions (João Barbosa)

Pull request description:

Current approach
 - copy accumulated `ret` vector to `arrTmp`
 - drop unnecessary elements from `arrTmp`
 - reverse `arrTmp`
 - clear `ret`
 - copy `arrTmp` to the `ret`

New approach
 - create a vector from the accumulated `ret` with just the necessary elements already reversed
 - copy it to the result

This PR doesn't change behavior.

ACKs for top commit:

ryanofsky:
  Code review ACK 25bc17fceb08ee9625c5e09e2579117ec6f7a1c5. Just comment and commit message tweaks since last review

Tree-SHA512: 87906561e3accdbdb0f4a8194cbcd76ea53ae53d0ce135b90bc54a5f77e300b14ef08505e7daf1fe52426f135442a743da5a027416a769bd454922357cebe7c0

Backport of Core PR17746

This also fixes the linter complaining about potential use-after-erase on the first iterator.

Test Plan

ninja check check-functional

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable