Don't use boost range adaptors in CDeterministicMNList#2327
Don't use boost range adaptors in CDeterministicMNList#2327UdjinM6 merged 1 commit intodashpay:developfrom
Conversation
There was a problem hiding this comment.
Nice! The less dependencies the better :)
See inline comments.
Side note: conceptually, it's a bit concerning that we have to loop to build the vector only to pass this vector to some function to loop over it again. Sounds like a good place for some refactoring in the future (but I'm fine with this PR as a drop-in replacement for boost stuff for now).
src/evo/deterministicmns.h
Outdated
src/evo/deterministicmns.h
Outdated
There was a problem hiding this comment.
same or even
- for (auto txout : block.vtx[0]->vout) {
- for (auto& dmn : dmnList.GetValidMNs()) {
+ for (const auto& txout : block.vtx[0]->vout) {
+ for (const auto& dmn : dmnList.GetValidMNs()) {while at it ;)
src/evo/deterministicmns.cpp
Outdated
There was a problem hiding this comment.
shouldn't we check for if (IsMNValid(p.second)) here?
There was a problem hiding this comment.
Oh, good you spotted this one
|
Agree that this solution is suboptimal, and while reading your concern I realized that this is maybe a good candidate for something like |
These cause crashes when used in for loops. Reason is very likely that temporary CDeterministicMNList objects are destroyed before entering the loop while the adaptors rely on these objects. Discovered in one of our devnets while calling "protx list"
08d2bfb to
18e7cc4
Compare
|
Pushed new version of this fix, based on |
These cause crashes when used in for loops. Reason is very likely that temporary CDeterministicMNList objects are destroyed before entering the loop while the adaptors rely on these objects. Discovered in one of our devnets while calling "protx list"
These cause crashes when used in for loops. Reason is very likely that
temporary CDeterministicMNList objects are destroyed before entering the
loop while the adaptors rely on these objects.
Discovered in one of our devnets while calling "protx list"