Skip to content

Warn in RPC, Qt, and log as node approaches tachyon, disable RPC after tachyon

Co-authored-by: Dagur Valberg Johannsson dagurval@pvv.ntnu.no

Summary

This commit adds two new facilities:

  • warn as the node approaches expiration (30 days before tachyon activation time by default)
  • after tachyon activation time elapses, expire the node by disabling the RPC interface.

This facility can be disabled with -noexpire and/or -noexpirerpc.

The app starts to warn about the upcoming expiration of Bitcoin Cash Node. The warning uses the pre-existing "GetWarnings()" mechanism to add an RPC warning as well as a Qt user interface warning.

The warning starts 30 days before tachyon activation time (30 days before May 15th 2021).

The warnings can be suppressed with -expire=0 on the CLI or expire=0 in the configuration file.

Warnings are also printed to the log every hour.

After tachyon activation time passes, the RPC is disabled, and warnings continue to appear in the log. This particular aspect can be individually suppressed with -expirerpc=0.

Notes:

  • Also contains the test: bchn-rpc-outdated-warnings
  • Also adds a unit test to: rpc_server_tests
  • This commit was inspired by !710 (closed) and !717 (closed)
  • It addresses issue #104 (closed).
  • It considers wall-clock time, not MTP time, and will therefore expire old nodes slightly ahead of the actual upgrade activation.

Test Plan

  • ninja check check-functional

Additionally, you can manually inspect that the RPC expires as intended right after the expiration deadline.

  1. Start the node with -tachyonactivationtime=<15 seconds into the future>
  2. Follow the Log -- the messages should transition from "Warning: This version of Bitcoin Cash Node is old and may fall out of network consensus in..." to "Warning: This version of Bitcoin Cash Node is old and may have fallen out of network consensus..." (the latter is the "already expired" message).
  3. Verify that after the node expires -- the RPC interface throws an error on everything but the "stop" command.

Screenshot of Warning

Screen_Shot_2020-08-14_at_12.47.56_AM

Screen_Shot_2020-08-14_at_12.48.06_AM

Edited by Calin Culianu

Merge request reports