HomePhabricator

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

Description

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

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.

Reviewers: #bitcoin_abc, emack

Reviewed By: #bitcoin_abc, emack

Differential Revision: https://reviews.bitcoinabc.org/D13220

Details

Provenance
bytesofmanAuthored on Mar 2 2023, 01:04
bytesofmanPushed on Mar 2 2023, 18:30
Reviewer
Restricted Project
Differential Revision
D13220: [alias-server] Isolate valid registrations not in db before adding
Parents
rABC17d9fc1b7199: Remove magic number for tx version in bitcoin-tx
Branches
Unknown
Tags
Unknown