T3059
Depends on D13489
This diff makes changes required to accept the IFP address as the designated alias registration address.
Two unique properties of the IFP address require changes to support.
- The IFP address receives Coinbase txs
- The IFP address is P2SH and not P2PKH
alias-server is refactored so that all chronik calls (which require hash160 and address type) are made with variables instead of 'p2pkh' hardcoded. For simplification, the necessary variables are determined from config.aliasConstants.registrationAddress. This way only a single input is required in config.
This diff is a good example of some of the challenges raised by getting too far ahead of reviews. Some code changes were discovered to be necessary to get tests and test scripts to work as I was working on this diff. Initially I had just planned to make a few quick changes so I could do some local testing. However, since these changes will be needed in the production app, I decided it was worthwhile to push up this diff.
- Refactoring chronik functions to accept p2sh input required adding support for new input parameters
- Some parameters chronik requires need to be calculated if they are not hardcoded. They should not be hardcoded, so this diff calculates them
- Due to quirks in ecashaddrjs which I've put up a task to fix later, it is necesary to add a util function to convert a unit 8 array (returned by cashaddr.decode) to a string (accepted by chronik)
- Also necessary to apply .toLowerCase() to the type returned by ecashaddrjs, as chronik only accepts lowercase address type
- Discovered a bug in that the confirmedTxs db was not removed from scripts/generateMocks.js earlier in the stack where it should have been, so removed it here
In short, this is a bad diff. However, it does the minimum necessary to support a P2SH registration address.