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

Make NU peer management logic upgrade-agnostic #3512

Merged
merged 5 commits into from Sep 18, 2018

Conversation

@str4d
Copy link
Contributor

str4d commented Sep 12, 2018

Closes #3487.

str4d added some commits Sep 12, 2018

@str4d str4d added this to the v2.0.1 milestone Sep 12, 2018

@str4d str4d requested review from bitcartel and LarryRuane Sep 12, 2018

@str4d str4d added this to In Review in Zcashd Team Sep 12, 2018

@bitcartel
Copy link
Contributor

bitcartel left a comment

utACK

{
LogPrintf("peer=%d using obsolete version %i; disconnecting\n", pfrom->id, pfrom->nVersion);
pfrom->PushMessage("reject", strCommand, REJECT_OBSOLETE,
strprintf("Version must be %d or greater",
chainparams.GetConsensus().vUpgrades[Consensus::UPGRADE_OVERWINTER].nProtocolVersion));
chainparams.GetConsensus().vUpgrades[
CurrentEpoch(GetHeight(), chainparams.GetConsensus())].nProtocolVersion));

This comment has been minimized.

@bitcartel

bitcartel Sep 12, 2018

Contributor

Could GetHeight() have changed since the if conditional? If yes, the error message returned will be inaccurate.

This comment has been minimized.

@str4d

str4d Sep 13, 2018

Contributor

Yes it could, because we don't hold a lock on cs_main for most of ProcessMessage(). However, it would only generate an inaccurate message if GetHeight() returned an activation height on line 5154, and then a rollback happened (reverting to the pre-upgrade epoch) before the call on line 5160.

@ebfull

ebfull approved these changes Sep 17, 2018

auto idx = nextEpoch.get();
int nActivationHeight = params.vUpgrades[idx].nActivationHeight;

if (nActivationHeight > 0 &&

This comment has been minimized.

@Eirik0

Eirik0 Sep 17, 2018

Contributor

Checking nActivationHeight > 0 might be redundant now, but no harm.
Edit: actually in hindsight, I am not totally sure about this...

conn.rejectMessage = message


class NUPeerManagementTest(BitcoinTestFramework):

This comment has been minimized.

@Eirik0

Eirik0 Sep 17, 2018

Contributor

Nit: It's easier to review if the move and the changes are separate commits.

This comment has been minimized.

@str4d

str4d Sep 17, 2018

Contributor

Sorry, I forgot that GitHub doesn't detect and render it as a moved file if there are any changes.

@Eirik0

Eirik0 approved these changes Sep 17, 2018

Copy link
Contributor

Eirik0 left a comment

utAck. Looks good.

@ebfull

This comment has been minimized.

Copy link
Contributor

ebfull commented Sep 17, 2018

@zkbot r+

@zkbot

This comment has been minimized.

Copy link
Collaborator

zkbot commented Sep 17, 2018

📌 Commit 8e057ad has been approved by ebfull

@zkbot

This comment has been minimized.

Copy link
Collaborator

zkbot commented Sep 17, 2018

⌛️ Testing commit 8e057ad with merge f685a36...

zkbot added a commit that referenced this pull request Sep 17, 2018

Auto merge of #3512 - str4d:3487-nu-peer-management, r=ebfull
Make NU peer management logic upgrade-agnostic

Closes #3487.
@zkbot

This comment has been minimized.

Copy link
Collaborator

zkbot commented Sep 17, 2018

💔 Test failed - pr-merge

@str4d

This comment has been minimized.

Copy link
Contributor

str4d commented Sep 18, 2018

@zkbot

This comment has been minimized.

Copy link
Collaborator

zkbot commented Sep 18, 2018

⌛️ Testing commit 8e057ad with merge 49356ed...

zkbot added a commit that referenced this pull request Sep 18, 2018

Auto merge of #3512 - str4d:3487-nu-peer-management, r=ebfull
Make NU peer management logic upgrade-agnostic

Closes #3487.
@zkbot

This comment has been minimized.

Copy link
Collaborator

zkbot commented Sep 18, 2018

☀️ Test successful - pr-merge
Approved by: ebfull
Pushing 49356ed to master...

@zkbot zkbot merged commit 8e057ad into zcash:master Sep 18, 2018

1 check passed

homu Test successful
Details

Zcashd Team automation moved this from In Review to Released (Merged in Master) Sep 18, 2018

@str4d str4d deleted the str4d:3487-nu-peer-management branch Sep 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment