Page MenuHomePhabricator

Added fActiveChainTipIsUAHF as a global flag to indicate active chain is UAHF (potentially net_processing code needs this for NODE_CASH stuff)
AbandonedPublic

Authored by CCulianu on Aug 23 2017, 10:41.

Details

Reviewers
freetrader
deadalnix
sickpig
schancel
zander
Group Reviewers
Restricted Project
Summary

My D478 needs to know if active chain is UAHF to know whether to ignore peer ADDR messages if peer is not NODE_CASH.
This global flag is a much more efficient way to communicate that information than calling IsUAHFEnabledForCurrentBlock() (which needs cs_main).

D478 depends on this diff.

Test Plan

make check && cd qa/pull-tester && ./rpc-tests.py -extended

Diff Detail

Repository
rABC Bitcoin ABC
Branch
master
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 748
Build 748: arc lint + arc unit

Event Timeline

In classic I needed a 3-state.

  1. not active
  2. active, waiting for > 1MB block
  3. active

If you follow that I think you can delete some more overhead elsewhere.

In D479#8388, @zander wrote:

In classic I needed a 3-state.

  1. not active
  2. active, waiting for > 1MB block
  3. active

If you follow that I think you can delete some more overhead elsewhere.

That's actually a very strong approach.

I promise to make this change after this simpler approach gets approved. I also think perhaps existing logic will get simplified a little. I know 1 function in particular that can get much simpler.. or at least simpler to read.

The flag should not really be necessary in my view, although I can live with it as an interim measure.

I've added D480 which introduces a checkpoint for the mainnet UAHF fork block.
This could be used to simplify the check whether we are pre-fork or post-fork to one involving only block height.
Then we should be able to do away with it with this flag again.

The flag should not really be necessary in my view, although I can live with it as an interim measure.

It's not strictly, necessary, no, but it saves on having to lock cs_main to check chianActive.Tip()->nHeight, which one would have to do without the flag. See D478 where such a check is made without needing to hold a lock.

Apparently you guys like holding locks for trivial checks rather than caching them

Can't say I agree.. but I'll abandon this revision now.