Page MenuHomePhabricator

Add function 'IsGreatWallEnabled'
ClosedPublic

Authored by dagurval on Jan 21 2019, 21:48.

Details

Summary

This checks whether network upgrade code named 'great wall' has activated.

Test Plan

Added test

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jasonbcox requested changes to this revision.Jan 22 2019, 00:51
jasonbcox added a subscriber: jasonbcox.
jasonbcox added inline comments.
src/consensus/activation.cpp
62 ↗(On Diff #6798)

Please check if this needs to be broken up into separate functions similar to magnetic anomaly. Iirc the inner function is called directly from another context.

src/test/activation_tests.cpp
13 ↗(On Diff #6798)

These tests probably don't add much value on their own. Activation of the upgrade features tends to be covered in their own tests, which would overlap with this test entirely.

This revision now requires changes to proceed.Jan 22 2019, 00:51
src/consensus/activation.cpp
62 ↗(On Diff #6798)

If it is needed, it can be done.

src/test/activation_tests.cpp
13 ↗(On Diff #6798)

It adds value because the tests you are mentioning do not exist. This can be removed if/when obsolete and if you feel strongly about it, you'll even be able to do it. There is no point in delaying @dagurval 's work for this.

markblundeberg added inline comments.
src/test/activation_tests.cpp
25 ↗(On Diff #6798)

Hmm does this work? nTime single block timestamp but the activation is based on median-time-past.

deadalnix requested changes to this revision.Jan 22 2019, 01:38
deadalnix added inline comments.
src/consensus/activation.cpp
53 ↗(On Diff #6798)

remove

src/test/activation_tests.cpp
16 ↗(On Diff #6798)

remove

17 ↗(On Diff #6798)

config

25 ↗(On Diff #6798)

If the block has no parent yes, but this definitively should test or MTP

dagurval added inline comments.
src/consensus/activation.cpp
62 ↗(On Diff #6798)

I'm not sure how to check for that. I at least don't need a different function signature.

src/test/activation_tests.cpp
25 ↗(On Diff #6798)

For brevity I'm using an edge case of MTP where if the block has no parent, it's nTime becomes MTP.

Added a comment to clarify.

Check that MTP is used, not nTime

src/test/activation_tests.cpp
25 ↗(On Diff #6812)

Can you make sure mtp is tested, by producing 11 headers instead ? It's fairly easy to declare an array of 11 CBlockIndex

deadalnix requested changes to this revision.Jan 22 2019, 17:14
This revision now requires changes to proceed.Jan 22 2019, 17:14
jasonbcox added inline comments.
src/test/activation_tests.cpp
13 ↗(On Diff #6798)

Fair.

This revision is now accepted and ready to land.Jan 23 2019, 00:38
This revision was automatically updated to reflect the committed changes.