Page MenuHomePhabricator

[ConnectBlock] Use an index to refers into blockundo.vtxundo rather than pusing as we go

Authored by deadalnix on Feb 15 2020, 16:43.



This makes the code more solid as there is no risk of reallocation mid way.

Test Plan
ninja all check-all

Diff Detail

rABC Bitcoin ABC
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

deadalnix created this revision.Feb 15 2020, 16:43
Herald added a reviewer: Restricted Project. · View Herald TranscriptFeb 15 2020, 16:43
jasonbcox requested changes to this revision.Feb 15 2020, 17:02
jasonbcox added a subscriber: jasonbcox.
jasonbcox added inline comments.
1912 ↗(On Diff #16409)

Any reason to not move this initialization down to where txIndex is initialized? It isn't used until that loop anyway, and block.vtx.size() doesn't change.

This revision now requires changes to proceed.Feb 15 2020, 17:02
deadalnix requested review of this revision.Feb 15 2020, 17:40
deadalnix added inline comments.
1912 ↗(On Diff #16409)

This is where everything is setup. If anything we'd have to move the other loop up, but this doesn't seem like the best move for this patch.

jasonbcox accepted this revision.Feb 15 2020, 17:42
This revision is now accepted and ready to land.Feb 15 2020, 17:42