HomePhabricator

Alert if it is very likely we are getting a bad chain
36cba8f1182eUnpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

Alert if it is very likely we are getting a bad chain

Create a monitoring task that counts how many blocks have been found in the last four hours.

If very few or too many have been found, an alert is triggered.

"Very few" and "too many" are set based on a false positive rate of once every fifty years of constant running with constant hashing power, which works out to getting 5 or fewer or 48 or more blocks in four hours (instead of the average of 24).

Only one alert per day is triggered, so if you get disconnected from the network (or are being Sybil'ed) -alertnotify will be triggered after 3.5 hours but you won't get another -alertnotify for 24 hours.

Tested with a new unit test and by running on the main network with -debug=partitioncheck

Run test/test_bitcoin --log_level=message to see the alert messages:

WARNING: check your network connection, 3 blocks received in the last 4 hours (24 expected)
WARNING: abnormally high number of blocks generated, 60 blocks received in the last 4 hours (24 expected)

The -debug=partitioncheck debug.log messages look like:

ThreadPartitionCheck : Found 22 blocks in the last 4 hours
ThreadPartitionCheck : likelihood: 0.0777702

Details

Provenance
Gavin Andresen <gavinandresen@gmail.com>Authored on Mar 26 2015, 15:20
deadalnixPushed on May 14 2017, 22:04
Parents
rABCb4c219b62223: Merge pull request #5964
Branches
Unknown
Tags
Unknown

Event Timeline

Gavin Andresen <gavinandresen@gmail.com> committed rABC36cba8f1182e: Alert if it is very likely we are getting a bad chain (authored by Gavin Andresen <gavinandresen@gmail.com>).May 14 2015, 18:58