Skip to content

contrib: Bugfix for checking bad dns seeds without casting in makeseeds.py - #26681

Merged
fanquake merged 1 commit into
bitcoin:masterfrom
yusufsahinhamza:fix-makeseeds-bug
Apr 20, 2023
Merged

fanquake merged 1 commit into
bitcoin:masterfrom
yusufsahinhamza:fix-makeseeds-bug

Conversation

@yusufsahinhamza

@yusufsahinhamza yusufsahinhamza commented Dec 10, 2022 •

Copy link
Copy Markdown
Contributor
  • Since seed lines comes with str type, comparing good column directly with 0 (int type) in the if statement was not working at all. This is fixed by casting int type to the values in the good column of seeds text file.
  • Lines that starts with comment in the seeds text file are now ignored.
  • If statement for checking bad seeds are moved to the top of the parseline function as if a seed is bad; there is no point of going forward from there.

Since this bug-fix eliminates bad seeds over 550k in the first place, in my case; particular job for parsing all seeds speed is up by 600% and whole script's speed is up by %30.

Note that stats in the terminal are not going to include bad seeds after this fix, which would be the same if this bug were never there before.

Since seed lines comes with 'str' type, comparing it directly with 0
('int' type) in the if statement was not working at all. This is fixed
by casting 'int' type to the values in the 'good' column of seeds text file.

Lines that starts with comment in the seeds text file are now ignored.

If statement for checking bad seeds are moved to the top of the 'parseline'
function as if seed is bad, there is no point of going forward from there.
@DrahtBot

DrahtBot commented Dec 10, 2022 •

Copy link
Copy Markdown
Contributor

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 achow101, jonatack

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

@yusufsahinhamza yusufsahinhamza changed the title net, contrib: Fix checking bad dns seeds without casting net, contrib: Fix checking bad dns seeds without casting in makeseeds.py Dec 11, 2022
@yusufsahinhamza

Copy link
Copy Markdown
Contributor Author

If we still want to see the number of total seeds on the terminal, we can simply print "lines length -1 (comment for the column names)". And it could look like that: Loading and parsing DNS seeds…Done, 559142 seeds loaded.

@mzumsande mzumsande left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(sorry, got confused, pls ignore)

@yusufsahinhamza yusufsahinhamza changed the title net, contrib: Fix checking bad dns seeds without casting in makeseeds.py net, contrib: Bugfix for checking bad dns seeds without casting in makeseeds.py Dec 26, 2022
@achow101

Copy link
Copy Markdown
Member

ACK 3cc989d

Comment thread contrib/seeds/makeseeds.py Resolved
Comment thread contrib/seeds/makeseeds.py Resolved

@jonatack jonatack left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 3cc989d

Edit: modulo #26681 (comment)

@fanquake fanquake changed the title net, contrib: Bugfix for checking bad dns seeds without casting in makeseeds.py contrib: Bugfix for checking bad dns seeds without casting in makeseeds.py Apr 20, 2023
@fanquake
fanquake merged commit b627924 into bitcoin:master Apr 20, 2023
@bitcoin bitcoin deleted a comment from bavr2020 Apr 20, 2023
@bitcoin bitcoin locked and limited conversation to collaborators Apr 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants