Page MenuHomePhabricator

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

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

Details

Summary

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

Test Plan
ninja all check-all

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
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.
src/validation.cpp
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.
src/validation.cpp
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