Skip to content

Conversation

@brunoerg
Copy link
Contributor

Got some inspiration from feature_init. This PR tests whether perturbing anchors.dat doesn't throw any error during initialization.

bitcoin/src/addrdb.cpp

Lines 223 to 235 in 3f1f5f6

std::vector<CAddress> ReadAnchors(const fs::path& anchors_db_path)
{
std::vector<CAddress> anchors;
try {
DeserializeFileDB(anchors_db_path, anchors, CLIENT_VERSION | ADDRV2_FORMAT);
LogPrintf("Loaded %i addresses from %s\n", anchors.size(), fs::quoted(fs::PathToString(anchors_db_path.filename())));
} catch (const std::exception&) {
anchors.clear();
}
fs::remove(anchors_db_path);
return anchors;
}

@DrahtBot DrahtBot added the Tests label Oct 14, 2022
@brunoerg brunoerg force-pushed the 2022-10-test-perturb-anchors branch from 9eab07e to 33fdfc7 Compare October 28, 2022 16:00
@brunoerg
Copy link
Contributor Author

Force-pushed:

  • Perturb file in a lighter way (e.g. single byte)
  • Added a assert_debug_log to ensure that 0 anchors will be tried for connection.

@DrahtBot
Copy link
Contributor

DrahtBot commented Dec 5, 2022

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.

Type Reviewers
ACK MarcoFalke

If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

@achow101 achow101 requested a review from maflcko April 25, 2023 15:21
@maflcko
Copy link
Member

maflcko commented Apr 27, 2023

lgtm ACK 33fdfc7

@DrahtBot DrahtBot removed the request for review from maflcko April 27, 2023 08:33
@fanquake fanquake merged commit 904a987 into bitcoin:master Apr 27, 2023
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Apr 28, 2023
…nitialization

33fdfc7 test: perturb anchors.dat to test it doesn't throw an error during initialization (brunoerg)

Pull request description:

  Got some inspiration from `feature_init`. This PR tests whether perturbing `anchors.dat` doesn't throw any error during initialization.

  https://github.com/bitcoin/bitcoin/blob/3f1f5f6f1ec49d0fb2acfddec4021b3582ba0553/src/addrdb.cpp#L223-L235

ACKs for top commit:
  MarcoFalke:
    lgtm ACK 33fdfc7

Tree-SHA512: e6584debb37647677581fda08366b45b42803022cc4c4f1d5a7bd5e9e04d64da77656dad2b804855337487bdcfc891f300a2e03668d6122de769dd14f39af9ed
@bitcoin bitcoin locked and limited conversation to collaborators Apr 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants