Skip to content
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

Several patches #100

Merged
merged 15 commits into from
Mar 12, 2015
Merged

Several patches #100

merged 15 commits into from
Mar 12, 2015

Conversation

fsb4000
Copy link
Contributor

@fsb4000 fsb4000 commented Feb 18, 2015

This introduces the concept of the 'sync node', which is the one we
asked for missing blocks. In case the sync node goes away, a new one
will be selected.

For now, the heuristic is very simple, but it can easily be extended
later to add better policies.

Same as novacoin-project/novacoin@28f9882
Similar to bitcoin/bitcoin@6ed71b5
(I don't delete old sync code because it does conflict with nothing and that's OK "Ask the first connected node for block updates" before this node can be selected for block updates in net.cpp)
(Although I can remove old sync code if necessary.)
Issue description: bitcoin/bitcoin#1234

This introduces the concept of the 'sync node', which is the one we
asked for missing blocks. In case the sync node goes away, a new one
will be selected.

For now, the heuristic is very simple, but it can easily be extended
later to add better policies.
@fsb4000
Copy link
Contributor Author

fsb4000 commented Feb 19, 2015

I added "using pthread_create instead CreateThread on Windows". Not sure that it is somehow connected with the problem, but it's the only thing that I did Windows only.(for compatibility with mingw 4.9.2)
Check whether it does break WinBuilder or not...

@fsb4000
Copy link
Contributor Author

fsb4000 commented Feb 20, 2015

Maybe #6 fixed. Need additional tests...

@fsb4000
Copy link
Contributor Author

fsb4000 commented Feb 21, 2015

OpenSSL Fix = bitcoin/bitcoin#5634 and bitcoin/bitcoin#5640

@fsb4000
Copy link
Contributor Author

fsb4000 commented Feb 23, 2015

Make lsn_reset ("detach databases") optional and off by default = bitcoin/bitcoin#1119

@fsb4000 fsb4000 changed the title Make sure we always have a node to do IBD from Several patches Feb 23, 2015
@domob1812
Copy link
Contributor

Thanks for the pull request! In general, please don't submit "several patches" but split them into logical units (for the future).

Also, without having reviewed the code in full, I have at least some suggestions right now:

  1. The lsn_reset patch seems fine, but I would prefer to have lsn_reset on by default. Otherwise people may get problems when they try to backup / restore / transfer their data folder and have no idea why. If they are aware of the possible implications, then they can turn it off for themselves.

  2. Please do not include the hardcoded nodes. I don't think that's a good idea (do we have more info about the nodes, like their capacity, who runs them, how they are secured). We have IRC discovery for that, and may add DNS seeds in the future.

  3. Please do not introduce checkpoints. It was a deliberate decision not to have them (not by me, but it was made). Also, you don't even mention that in your forum post. That's a very good demonstration of why I suggest to have multiple pull requests for multiple things, and not just a generic "several patches".

Fourth Octet: 185
(67 * 16777216) + (225 * 65536) + (171 * 256) + (185) = 1138863033
*/
unsigned int pnSeed[] = {2990412266, 1138863033 };
Copy link
Contributor

Choose a reason for hiding this comment

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

Why add the comment and not just #define a macro that does the calculation for you?

(Besides, I don't think we should hardcode the nodes.)

@fsb4000
Copy link
Contributor Author

fsb4000 commented Feb 24, 2015

@domob1812:

Nit pick: Please remove the blank line.

Sure. Added to the last commit(Automatic creation huntercoin.conf) I do not know how to edit an arbitrary commit, only the last. Let me know if you know how to edit an any commit.

@domob1812:

Why add the comment and not just #define a macro that does the calculation for you?
(Besides, I don't think we should hardcode the nodes.)

Without adding nodes, huntercoin does not start synchronization from scratch. Although it works, if user downloads the database from your site( http://chain.huntercoin.org/ )(because your database has addr.dat with node IPs)
Of course I can add a macro. Could you prompt me a name for this macro?

@domob1812
Copy link
Contributor

Just add another commit which cleans up everything. (This is not perfect, but I think it is good enough for now.)

Actually, Huntercoin should discover nodes via IRC (as Bitcoin did back in the day). Is this broken? If so, then we should indeed try to fix it. If not, I don't think we should be adding the hardcoded nodes.

@fsb4000
Copy link
Contributor Author

fsb4000 commented Feb 24, 2015

IRC code is good, but IRC servers often is offline(or maybe they blocked some IPs, not sure)
Sometimes everything is OK, sometimes I get
IRC connect failed (at debug.log)
IRC waiting 71 seconds to reconnect
..................................
IRC connect failed
IRC waiting 138 seconds to reconnect
and so. I think better use all ways to connect: IRC + harcode seeds + hardcode dns seeds...

For example, classic namecoin has 3 hardcoded nodes: https://github.com/namecoin/namecoin/blob/b043fba28018721b68c90edfc81b9eacb070b47d/src/namecoin.cpp#L2702

@fsb4000
Copy link
Contributor Author

fsb4000 commented Feb 25, 2015

@domob1812:

Do we have more info about the nodes, like their capacity, who runs them, how they are secured?

Yes, we have. User can't synchronize. The official advices were:
BGB:

Yes this has been a problem. You can try adding my node
addnode=67.225.171.185

Snailbrain:

you can try this node:- 178.62.17.234
but have limited to 40 connections max and all used atm..
but if you give me your ip and port is open, i can connect=you - i believe this should work even though i'm maxed.

So I added 67.225.171.185 and 178.62.17.234 in the code.

@domob1812
Copy link
Contributor

Ok, I see. In that case, if IRC is down sometimes (wasn't aware of that), I think adding the nodes makes sense. Please just use a macro like

#define CONVERT_IP4(a, b, c, d)
(((a) << 24) + ((b) << 16) + ((c) << 8) + (d))

instead of the manual computation.

@fsb4000
Copy link
Contributor Author

fsb4000 commented Feb 25, 2015

@domob1812:

Please do not introduce checkpoints. It was a deliberate decision not to have them (not by me, but it was made). Also, you don't even mention that in your forum post. That's a very good demonstration of why I suggest to have multiple pull requests for multiple things, and not just a generic "several patches".

Done, https://github.com/fsb4000/huntercoin/commit/6b7eed1d458ea9d17fbbcc2823cd1f71cb777834

@domob1812:

Please just use a macro like

#define CONVERT_IP4(a, b, c, d) \
(((a) << 24) + ((b) << 16) + ((c) << 8) + (d))

instead of the manual computation.

Done, https://github.com/fsb4000/huntercoin/commit/057a64ed87a1a0e3261bf7ef60784375ca041a7b
(third IP I found here: https://bitcointalk.org/index.php?topic=435170.msg8583919#msg8583919 )

@fsb4000
Copy link
Contributor Author

fsb4000 commented Feb 25, 2015

@domob1812 :

The lsn_reset patch seems fine, but I would prefer to have lsn_reset on by default. Otherwise people may get problems when they try to backup / restore / transfer their data folder and have no idea why. If they are aware of the possible implications, then they can turn it off for themselves.

done, https://github.com/fsb4000/huntercoin/commit/1ea795dd5055c331793686a6f155c6a5c2ebb2b5

Snailbrain, please,in the next release which will include the pull request, provide details about command line command -detachdb=0 which really speeds up the client shutdown
(-detachdb=0 for huntercoind and uncheck checkbox "Detach databases at shutdown" for Qt version)
detach

@fsb4000
Copy link
Contributor Author

fsb4000 commented Feb 25, 2015

"Automatic creation huntercoin.conf" is similar to jl777/btcd@be2f732 (the first time where I saw the auto creation .conf file)

chronokings added a commit that referenced this pull request Mar 12, 2015
@chronokings chronokings merged commit 5d71c05 into chronokings:master Mar 12, 2015
@fsb4000 fsb4000 deleted the sync branch June 17, 2015 07:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants