-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BlockchainDB: shorter fixup() #9289
base: master
Are you sure you want to change the base?
Conversation
Instead of hard-coding all missing key images into the code and inserting if missing, we simply pop all blocks after height 202611. This makes the `monerod` binary about 0.35% smaller.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this net improves the clarity of the code (the original commit referenced in the PR noted the change was a temporary measure, surely it's well past its expiration by this juncture).
if (height() > 685498) | ||
{ | ||
for (const auto &kis: key_images_685498) | ||
crypto::key_image ki; | ||
epee::string_tools::hex_to_pod(first_missing_key_image_202612, ki); | ||
if (!has_key_image(ki)) | ||
{ | ||
crypto::key_image ki; | ||
epee::string_tools::hex_to_pod(kis, ki); | ||
if (!has_key_image(ki)) | ||
{ | ||
LOG_PRINT_L1("Fixup: adding missing spent key " << ki); | ||
add_spent_key(ki); | ||
} | ||
LOG_PRINT_L1("Fixup: detected missing key images from block 202612! Popping blocks..."); | ||
while (height() > 202612) | ||
pop_block(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is is possible for nodes to have a correct 202612
but incorrect 685498
? It seems they won't be fixed here since missing 685498
key images are no longer checked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not really. They get fixed in the old code in tamdem. If the 202612 is correct, then so will the 685498. If the 202612 is incorrect, we pop everything after and including the 202612.
Instead of hard-coding all missing key images into the code and inserting if missing, we simply pop all blocks after height 202611, forcing the node to re-sync. This PR makes the
monerod
binary about 0.3% smaller and only screws over people who are synced to height at least 202612 but haven't run a new binary in over 8 years with the DB fixup commit a98e976.