Page MenuHomePhabricator

[alias-server] Isolate valid registrations not in db before adding
ClosedPublic

Authored by bytesofman on Mar 2 2023, 01:09.

Details

Summary

T2947

alias-server was running into issues where mongodb insertMany method combined with no double-inserting existing aliases was causing the insertMany method to fail.

This diff introduces a new function, getValidAliasTxsToBeAddedToDb, which isolates the aliases to be added before calling the insertMany db method. In testing, this corrects the issue.

Test Plan

Review new unit tests and npm test
Delete any previous existing database

sudo systemctl start mongod
mongosh
use ecashAliases
db.validAliasTxs.drop()

Run Cashtab with aliases enabled

In `/web/cashtab`, enable aliases and `npm start`
In a new terminal,

cd web/alias-server
node index.js

In a browser running alias enabled cashtab, create a handful of new aliases. Monitor the logs of alias-server to see that these are added to the database when the tx confirms.

Diff Detail

Repository
rABC Bitcoin ABC
Branch
patch-db-bug
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 22200
Build 44035: Build Diff
Build 44034: arc lint + arc unit