Skip to content

Commit 2169692

Browse files
Load activations in block order
1 parent 6eadfba commit 2169692

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/omnicore/omnicore.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2899,17 +2899,22 @@ void CMPTxList::LoadActivations(int blockHeight)
28992899

29002900
PrintToLog("Loading feature activations from levelDB\n");
29012901

2902-
for (it->SeekToFirst(); it->Valid(); it->Next()) {
2903-
skey = it->key();
2904-
svalue = it->value();
2905-
std::string itData = svalue.ToString();
2902+
std::vector<std::pair<int64_t, uint256> > loadOrder;
29062903

2904+
for (it->SeekToFirst(); it->Valid(); it->Next()) {
2905+
std::string itData = it->value().ToString();
29072906
std::vector<std::string> vstr;
29082907
boost::split(vstr, itData, boost::is_any_of(":"), token_compress_on);
2909-
if (4 != vstr.size()) continue;
2908+
if (4 != vstr.size()) continue; // unexpected number of tokens
29102909
if (atoi(vstr[2]) != OMNICORE_MESSAGE_TYPE_ACTIVATION || atoi(vstr[0]) != 1) continue; // we only care about valid activations
2910+
uint256 txid(it->key().ToString());;
2911+
loadOrder.push_back(std::make_pair(atoi(vstr[1]), txid));
2912+
}
29112913

2912-
uint256 hash(skey.ToString());
2914+
std::sort (loadOrder.begin(), loadOrder.end());
2915+
2916+
for (std::vector<std::pair<int64_t, uint256> >::iterator it = loadOrder.begin(); it != loadOrder.end(); ++it) {
2917+
uint256 hash = (*it).second;
29132918
uint256 blockHash = 0;
29142919
CTransaction wtx;
29152920
CMPTransaction mp_obj;

0 commit comments

Comments
 (0)