Page MenuHomePhabricator

Activate the new DAA by height instead of MTP.
ClosedPublic

Authored by deadalnix on Nov 30 2017, 12:49.

Details

Summary

As per title.

Test Plan
make check

Do IBD on testnet and mainnet.

Diff Detail

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

Event Timeline

Herald added a reviewer: Restricted Project. · View Herald Transcript
src/validation.cpp
1844 ↗(On Diff #1881)

Why the rename? We should come up with a sane naming scheme for hardforks if we're going to do this regularly.

src/validation.cpp
1844 ↗(On Diff #1881)

Because that's what the hard fork contained.

I don't think you're understanding my issue. Aren't we going to ALSO have a DAA in the next HF?

We'll rename this function if that's necessary.

src/validation.cpp
621 ↗(On Diff #1909)

It looks to me like the DAA was active on block 504032 not 504031. Should this be strictly greater than?

See:

➜  src git:(format) bitcoin-cli getblockhash 504030
0000000000000000008088d63f48da98b7352ad7c4c85f3d90b657cf50ff1ede
➜  src git:(format) bitcoin-cli getblockheader 0000000000000000008088d63f48da98b7352ad7c4c85f3d90b657cf50ff1ede
{
  "hash": "0000000000000000008088d63f48da98b7352ad7c4c85f3d90b657cf50ff1ede",
  "confirmations": 152,
  "height": 504030,
  "version": 536870912,
  "versionHex": "20000000",
  "merkleroot": "e81d019ec9140323d3ed12af417df7cc522dfa29d81e9f241ae66426d88ae5d2",
  "time": 1510603980,
  "mediantime": 1510594229,
  "nonce": 149615656,
  "bits": "18021abd",
  "difficulty": 522462745900.0715,
  "chainwork": "0000000000000000000000000000000000000000007caeb6b06723926608dccb",
  "previousblockhash": "0000000000000000015f3aaaf642ca8ad24ac34d080db87a1a44e9a8dd35b688",
  "nextblockhash": "0000000000000000011ebf65b60d0a3de80b8175be709d653b4c1a1beeb6ab9c"
}
➜  src git:(format) bitcoin-cli getblockhash 504031
0000000000000000011ebf65b60d0a3de80b8175be709d653b4c1a1beeb6ab9c
➜  src git:(format) bitcoin-cli getblockheader 0000000000000000011ebf65b60d0a3de80b8175be709d653b4c1a1beeb6ab9c
{
  "hash": "0000000000000000011ebf65b60d0a3de80b8175be709d653b4c1a1beeb6ab9c",
  "confirmations": 151,
  "height": 504031,
  "version": 536870912,
  "versionHex": "20000000",
  "merkleroot": "ab3dd7f110f3d17a490f4f9bb3697d1a8b621eac498bcd05fcd278b024c4eb7e",
  "time": 1510606688,
  "mediantime": 1510601033,
  "nonce": 3784514661,
  "bits": "18021abd",
  "difficulty": 522462745900.0715,
  "chainwork": "0000000000000000000000000000000000000000007caf3056159e6cf330bb47",
  "previousblockhash": "0000000000000000008088d63f48da98b7352ad7c4c85f3d90b657cf50ff1ede",
  "nextblockhash": "00000000000000000343e9875012f2062554c8752929892c82a0c0743ac7dcfd"
}
➜  src git:(format) bitcoin-cli getblockhash 504032
00000000000000000343e9875012f2062554c8752929892c82a0c0743ac7dcfd
➜  src git:(format) bitcoin-cli getblockheader 00000000000000000343e9875012f2062554c8752929892c82a0c0743ac7dcfd
{
  "hash": "00000000000000000343e9875012f2062554c8752929892c82a0c0743ac7dcfd",
  "confirmations": 150,
  "height": 504032,
  "version": 536870912,
  "versionHex": "20000000",
  "merkleroot": "8ebf2179d8b1ba0aaf5f15357f963b56f53a8c6207e0156b4b6def119be61bee",
  "time": 1510606995,
  "mediantime": 1510601742,
  "nonce": 273755974,
  "bits": "1805b42b",
  "difficulty": 192765961017.7023,
  "chainwork": "0000000000000000000000000000000000000000007caf5d3801a392ac1e2266",
  "previousblockhash": "0000000000000000011ebf65b60d0a3de80b8175be709d653b4c1a1beeb6ab9c",
  "nextblockhash": "000000000000000002173d0ac7b3a30f2aac302449778d72386c785d2c370429"
}
src/validation.cpp
621 ↗(On Diff #1909)

I see the MTP of 504031 is 1510601033 >= 1510600000 (true), but I don't understand why the difficulty didn't change on that block.

When the median time past[1] of the most recent 11 blocks (MTP-11) is greater than or equal to UNIX timestamp 1510600000 Bitcoin Cash will execute a hardfork according to this specification. Starting from the next block these three consensus rules changes will take effect:
...

https://github.com/Bitcoin-UAHF/spec/blob/master/nov-13-hardfork-spec.md

This revision is now accepted and ready to land.Dec 4 2017, 01:57
This revision was automatically updated to reflect the committed changes.