Page MenuHomePhabricator

[alias-server] Only add aliases to db if blockheight is avalanche confirmed
ClosedPublic

Authored by bytesofman on Jul 28 2023, 18:22.

Details

Summary

This is (almost) handled by only trying to update the server state if we have a blockheight that is avalanche confirmed. However, the chronik call to get tx history occurs after we have this avalanche confirmed block.

Possible edge case where

  1. Block comes in as avalanche confirmed
  2. Another block confirms before chronik call to get tx history
  3. Tx history is returned with some txs having a blockheight higher than the avalanche confirmed height of the server

In this case, we do not want to add any of these txs as valid alias registrations. They may indeed be valid, but they need to be picked up in the next loop processing an avalanche confirmed block.

Test Plan

npm test

Diff Detail

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

Event Timeline

apps/alias-server/test/chronikWsHandlerTests.js
145 ↗(On Diff #41626)

Annoyingly but reassuringly -- these unit tests where I had just picked a random blockheight as it was not critical to the unit test all broke with this change, as this blockheight will cut off some of the valid registrations in the app mocks with this change implemented.

Code doc comment improvement

This revision is now accepted and ready to land.Jul 28 2023, 20:16