[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