Merge branch 'master' into knorrium/backend_unit_tests

This commit is contained in:
Felipe Knorr Kuhn 2022-07-09 00:08:49 +02:00 committed by GitHub
commit 9b6bbaf51c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 3332 additions and 5897 deletions

View File

@ -2,93 +2,95 @@ name: CI Pipeline for the Backend and Frontend
on:
pull_request:
types: [ opened, review_requested, synchronize ]
env:
NODE_VERSION: 16.15.0
types: [opened, review_requested, synchronize]
jobs:
backend:
if: "!contains(github.event.pull_request.labels.*.name, 'ops') && !contains(github.head_ref, 'ops/')"
strategy:
matrix:
flavor: ['dev', 'prod']
runs-on: 'ubuntu-latest'
node: ["16.16.0", "18.5.0"]
flavor: ["dev", "prod"]
fail-fast: false
runs-on: "ubuntu-latest"
name: Backend (${{ matrix.flavor }})
name: Backend (${{ matrix.flavor }}) - node ${{ matrix.node }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: ${{ matrix.flavor }}
path: ${{ matrix.node }}/${{ matrix.flavor }}
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://registry.npmjs.org'
node-version: ${{ matrix.node }}
registry-url: "https://registry.npmjs.org"
- name: Install
if: ${{ matrix.flavor == 'dev'}}
run: npm ci
working-directory: ${{ matrix.flavor }}/backend
working-directory: ${{ matrix.node }}/${{ matrix.flavor }}/backend
- name: Install (Prod dependencies only)
if: ${{ matrix.flavor == 'prod'}}
run: npm ci --omit=dev --omit=optional
working-directory: ${{ matrix.flavor }}/backend
working-directory: ${{ matrix.node }}/${{ matrix.flavor }}/backend
- name: Lint
- name: Lint
if: ${{ matrix.flavor == 'dev'}}
run: npm run lint
working-directory: ${{ matrix.flavor }}/backend
working-directory: ${{ matrix.node }}/${{ matrix.flavor }}/backend
- name: Test
- name: Unit Tests
if: ${{ matrix.flavor == 'dev'}}
run: npm run test
working-directory: ${{ matrix.flavor }}/backend
working-directory: ${{ matrix.node }}/${{ matrix.flavor }}/backend
- name: Build
run: npm run build
working-directory: ${{ matrix.flavor }}/backend
working-directory: ${{ matrix.node }}/${{ matrix.flavor }}/backend
frontend:
if: "!contains(github.event.pull_request.labels.*.name, 'ops') && !contains(github.head_ref, 'ops/')"
strategy:
matrix:
flavor: ['dev', 'prod']
runs-on: 'ubuntu-latest'
node: ["16.15.0", "18.5.0"]
flavor: ["dev", "prod"]
fail-fast: false
runs-on: "ubuntu-latest"
name: Frontend (${{ matrix.flavor }})
name: Frontend (${{ matrix.flavor }}) - node ${{ matrix.node }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: ${{ matrix.flavor }}
path: ${{ matrix.node }}/${{ matrix.flavor }}
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://registry.npmjs.org'
node-version: ${{ matrix.node }}
registry-url: "https://registry.npmjs.org"
- name: Install (Prod dependencies only)
run: npm ci --omit=dev --omit=optional
if: ${{ matrix.flavor == 'prod'}}
working-directory: ${{ matrix.flavor }}/frontend
working-directory: ${{ matrix.node }}/${{ matrix.flavor }}/frontend
- name: Install
if: ${{ matrix.flavor == 'dev'}}
run: npm ci
working-directory: ${{ matrix.flavor }}/frontend
working-directory: ${{ matrix.node }}/${{ matrix.flavor }}/frontend
- name: Lint
if: ${{ matrix.flavor == 'dev'}}
run: npm run lint
working-directory: ${{ matrix.flavor }}/frontend
working-directory: ${{ matrix.node }}/${{ matrix.flavor }}/frontend
# - name: Test
# - name: Test
# run: npm run test
- name: Build
run: npm run build
working-directory: ${{ matrix.flavor }}/frontend
working-directory: ${{ matrix.node }}/${{ matrix.flavor }}/frontend

2
.nvmrc
View File

@ -1 +1 @@
v16.15.0
v16.16.0

View File

@ -168,7 +168,7 @@ class Blocks {
blockExtended.extras.avgFeeRate = stats.avgfeerate;
}
if (['mainnet', 'testnet', 'signet', 'regtest'].includes(config.MEMPOOL.NETWORK)) {
if (['mainnet', 'testnet', 'signet'].includes(config.MEMPOOL.NETWORK)) {
let pool: PoolTag;
if (blockExtended.extras?.coinbaseTx !== undefined) {
pool = await this.$findBlockMiner(blockExtended.extras?.coinbaseTx);
@ -405,7 +405,7 @@ class Blocks {
if (blockHeightTip >= 2016) {
const previousPeriodBlockHash = await bitcoinApi.$getBlockHash(blockHeightTip - heightDiff - 2016);
const previousPeriodBlock = await bitcoinApi.$getBlock(previousPeriodBlockHash);
const previousPeriodBlock = await bitcoinClient.getBlock(previousPeriodBlockHash)
this.previousDifficultyRetarget = (block.difficulty - previousPeriodBlock.difficulty) / previousPeriodBlock.difficulty * 100;
logger.debug(`Initial difficulty adjustment data set.`);
}
@ -527,13 +527,15 @@ class Blocks {
}
}
const block = await bitcoinApi.$getBlock(hash);
let block = await bitcoinClient.getBlock(hash);
// Not Bitcoin network, return the block as it
if (['mainnet', 'testnet', 'signet'].includes(config.MEMPOOL.NETWORK) === false) {
return block;
}
block = prepareBlock(block);
// Bitcoin network, add our custom data on top
const transactions = await this.$getTransactionsExtended(hash, block.height, true);
const blockExtended = await this.$getBlockExtended(block, transactions);
@ -577,47 +579,43 @@ class Blocks {
}
public async $getBlocks(fromHeight?: number, limit: number = 15): Promise<BlockExtended[]> {
try {
let currentHeight = fromHeight !== undefined ? fromHeight : this.getCurrentBlockHeight();
const returnBlocks: BlockExtended[] = [];
if (currentHeight < 0) {
return returnBlocks;
}
if (currentHeight === 0 && Common.indexingEnabled()) {
currentHeight = await blocksRepository.$mostRecentBlockHeight();
}
// Check if block height exist in local cache to skip the hash lookup
const blockByHeight = this.getBlocks().find((b) => b.height === currentHeight);
let startFromHash: string | null = null;
if (blockByHeight) {
startFromHash = blockByHeight.id;
} else if (!Common.indexingEnabled()) {
startFromHash = await bitcoinApi.$getBlockHash(currentHeight);
}
let nextHash = startFromHash;
for (let i = 0; i < limit && currentHeight >= 0; i++) {
let block = this.getBlocks().find((b) => b.height === currentHeight);
if (block) {
returnBlocks.push(block);
} else if (Common.indexingEnabled()) {
block = await this.$indexBlock(currentHeight);
returnBlocks.push(block);
} else if (nextHash != null) {
block = prepareBlock(await bitcoinApi.$getBlock(nextHash));
nextHash = block.previousblockhash;
returnBlocks.push(block);
}
currentHeight--;
}
let currentHeight = fromHeight !== undefined ? fromHeight : this.getCurrentBlockHeight();
const returnBlocks: BlockExtended[] = [];
if (currentHeight < 0) {
return returnBlocks;
} catch (e) {
throw e;
}
if (currentHeight === 0 && Common.indexingEnabled()) {
currentHeight = await blocksRepository.$mostRecentBlockHeight();
}
// Check if block height exist in local cache to skip the hash lookup
const blockByHeight = this.getBlocks().find((b) => b.height === currentHeight);
let startFromHash: string | null = null;
if (blockByHeight) {
startFromHash = blockByHeight.id;
} else if (!Common.indexingEnabled()) {
startFromHash = await bitcoinApi.$getBlockHash(currentHeight);
}
let nextHash = startFromHash;
for (let i = 0; i < limit && currentHeight >= 0; i++) {
let block = this.getBlocks().find((b) => b.height === currentHeight);
if (block) {
returnBlocks.push(block);
} else if (Common.indexingEnabled()) {
block = await this.$indexBlock(currentHeight);
returnBlocks.push(block);
} else if (nextHash != null) {
block = prepareBlock(await bitcoinClient.getBlock(nextHash));
nextHash = block.previousblockhash;
returnBlocks.push(block);
}
currentHeight--;
}
return returnBlocks;
}
public getLastDifficultyAdjustmentTime(): number {

View File

@ -3,14 +3,14 @@ import { BlockExtended } from '../mempool.interfaces';
export function prepareBlock(block: any): BlockExtended {
return <BlockExtended>{
id: block.id ?? block.hash, // hash for indexed block
timestamp: block.timestamp ?? block.blockTimestamp, // blockTimestamp for indexed block
timestamp: block.timestamp ?? block.time ?? block.blockTimestamp, // blockTimestamp for indexed block
height: block.height,
version: block.version,
bits: block.bits,
bits: (typeof block.bits === 'string' ? parseInt(block.bits, 16): block.bits),
nonce: block.nonce,
difficulty: block.difficulty,
merkle_root: block.merkle_root,
tx_count: block.tx_count,
merkle_root: block.merkle_root ?? block.merkleroot,
tx_count: block.tx_count ?? block.nTx,
size: block.size,
weight: block.weight,
previousblockhash: block.previousblockhash,

View File

@ -1,4 +1,4 @@
FROM node:16.15.0-buster-slim AS builder
FROM node:16.16.0-buster-slim AS builder
ARG commitHash
ENV DOCKER_COMMIT_HASH=${commitHash}
@ -11,7 +11,7 @@ RUN apt-get install -y build-essential python3 pkg-config
RUN npm install --omit=dev --omit=optional
RUN npm run build
FROM node:16.15.0-buster-slim
FROM node:16.16.0-buster-slim
WORKDIR /backend

View File

@ -1,4 +1,4 @@
FROM node:16.15.0-buster-slim AS builder
FROM node:16.16.0-buster-slim AS builder
ARG commitHash
ENV DOCKER_COMMIT_HASH=${commitHash}

File diff suppressed because it is too large Load Diff

View File

@ -63,18 +63,18 @@
"cypress:run:ci:staging": "node update-config.js TESTNET_ENABLED=true SIGNET_ENABLED=true LIQUID_ENABLED=true BISQ_ENABLED=true ITEMS_PER_PAGE=25 && npm run generate-config && start-server-and-test serve:local-staging 4200 cypress:run:record"
},
"dependencies": {
"@angular-devkit/build-angular": "~14.0.5",
"@angular/animations": "~14.0.5",
"@angular/cli": "~14.0.5",
"@angular/common": "~14.0.5",
"@angular/compiler": "~14.0.5",
"@angular/core": "~14.0.5",
"@angular/forms": "~14.0.5",
"@angular/localize": "~14.0.5",
"@angular/platform-browser": "~14.0.5",
"@angular/platform-browser-dynamic": "~14.0.5",
"@angular/platform-server": "~14.0.5",
"@angular/router": "~14.0.5",
"@angular-devkit/build-angular": "~13.3.7",
"@angular/animations": "~13.3.10",
"@angular/cli": "~13.3.7",
"@angular/common": "~13.3.10",
"@angular/compiler": "~13.3.10",
"@angular/core": "~13.3.10",
"@angular/forms": "~13.3.10",
"@angular/localize": "~13.3.10",
"@angular/platform-browser": "~13.3.10",
"@angular/platform-browser-dynamic": "~13.3.10",
"@angular/platform-server": "~13.3.10",
"@angular/router": "~13.3.10",
"@fortawesome/angular-fontawesome": "~0.10.2",
"@fortawesome/fontawesome-common-types": "~6.1.1",
"@fortawesome/fontawesome-svg-core": "~6.1.1",
@ -87,22 +87,22 @@
"browserify": "^17.0.0",
"clipboard": "^2.0.10",
"domino": "^2.1.6",
"echarts": "~5.3.3",
"echarts": "~5.3.2",
"express": "^4.17.1",
"lightweight-charts": "~3.8.0",
"ngx-echarts": "~14.0.0",
"ngx-echarts": "8.0.1",
"ngx-infinite-scroll": "^10.0.1",
"qrcode": "1.5.0",
"rxjs": "~7.5.5",
"tinyify": "^3.0.0",
"tlite": "^0.1.9",
"tslib": "~2.4.0",
"zone.js": "~0.11.6"
"zone.js": "~0.11.5"
},
"devDependencies": {
"@angular/compiler-cli": "~14.0.5",
"@angular/language-service": "~14.0.5",
"@nguniversal/builders": "~14.0.3",
"@angular/compiler-cli": "~13.3.10",
"@angular/language-service": "~13.3.10",
"@nguniversal/builders": "~13.1.1",
"@types/express": "^4.17.0",
"@types/node": "^12.11.1",
"@typescript-eslint/eslint-plugin": "^5.30.5",

View File

@ -529,7 +529,7 @@ if (browserWindowEnv && browserWindowEnv.BASE_MODULE === 'liquid') {
@NgModule({
imports: [RouterModule.forRoot(routes, {
initialNavigation: 'enabledNonBlocking',
initialNavigation: 'enabled',
scrollPositionRestoration: 'enabled',
anchorScrolling: 'enabled',
preloadingStrategy: PreloadAllModules

View File

@ -15,7 +15,7 @@
</td>
</tr>
<tr>
<td class="td-width" i18n="transaction.value|Transaction value">Value</td>
<td class="td-width" i18n="dashboard.latest-transactions.amount">Amount</td>
<td><app-amount [satoshis]="value"></app-amount></td>
</tr>
<tr>

View File

@ -12,7 +12,6 @@ if (browserWindowEnv.BASE_MODULE && (browserWindowEnv.BASE_MODULE === 'bisq' ||
routes = [
{
path: '',
pathMatch: 'full',
redirectTo: 'api/rest'
},
{
@ -32,7 +31,6 @@ if (browserWindowEnv.BASE_MODULE && (browserWindowEnv.BASE_MODULE === 'bisq' ||
routes = [
{
path: '',
pathMatch: 'full',
redirectTo: 'faq'
},
{

View File

@ -91,7 +91,6 @@ const routes: Routes = [
},
{
path: '',
pathMatch: 'full',
redirectTo: 'mempool',
},
{

View File

@ -952,6 +952,10 @@
<context context-type="sourcefile">src/app/bisq/bisq-transactions/bisq-transactions.component.html</context>
<context context-type="linenumber">20,21</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/block-overview-tooltip/block-overview-tooltip.component.html</context>
<context context-type="linenumber">18</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/dashboard/dashboard.component.html</context>
<context context-type="linenumber">124,125</context>
@ -1363,7 +1367,7 @@
<target>Echange</target>
<context-group purpose="location">
<context context-type="sourcefile">src/app/bisq/lightweight-charts-area/lightweight-charts-area.component.ts</context>
<context context-type="linenumber">90</context>
<context context-type="linenumber">99</context>
</context-group>
</trans-unit>
<trans-unit id="bisq-graph-volume" datatype="html">
@ -1371,7 +1375,7 @@
<target>Volume</target>
<context-group purpose="location">
<context context-type="sourcefile">src/app/bisq/lightweight-charts-area/lightweight-charts-area.component.ts</context>
<context context-type="linenumber">91</context>
<context context-type="linenumber">100</context>
</context-group>
</trans-unit>
<trans-unit id="4b137ec8bf73a47063740b75c0c40d5fd3c48015" datatype="html">
@ -2076,16 +2080,6 @@
<context context-type="linenumber">264,266</context>
</context-group>
</trans-unit>
<trans-unit id="bc4c61d3713989e3c8c6610fca3ea1ca1cb19edb" datatype="html">
<source>Value</source>
<target>Valeur</target>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/block-overview-tooltip/block-overview-tooltip.component.html</context>
<context context-type="linenumber">18</context>
</context-group>
<note priority="1" from="description">Transaction value</note>
<note priority="1" from="meaning">transaction.value</note>
</trans-unit>
<trans-unit id="cb1b52c13b95fa29ea4044f2bbe0ac623b890c80" datatype="html">
<source>Fee</source>
<target>Frais</target>

View File

@ -952,6 +952,10 @@
<context context-type="sourcefile">src/app/bisq/bisq-transactions/bisq-transactions.component.html</context>
<context context-type="linenumber">20,21</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/block-overview-tooltip/block-overview-tooltip.component.html</context>
<context context-type="linenumber">18</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/dashboard/dashboard.component.html</context>
<context context-type="linenumber">124,125</context>
@ -1363,7 +1367,7 @@
<target>Handler</target>
<context-group purpose="location">
<context context-type="sourcefile">src/app/bisq/lightweight-charts-area/lightweight-charts-area.component.ts</context>
<context context-type="linenumber">90</context>
<context context-type="linenumber">99</context>
</context-group>
</trans-unit>
<trans-unit id="bisq-graph-volume" datatype="html">
@ -1371,7 +1375,7 @@
<target>Volum</target>
<context-group purpose="location">
<context context-type="sourcefile">src/app/bisq/lightweight-charts-area/lightweight-charts-area.component.ts</context>
<context context-type="linenumber">91</context>
<context context-type="linenumber">100</context>
</context-group>
</trans-unit>
<trans-unit id="4b137ec8bf73a47063740b75c0c40d5fd3c48015" datatype="html">
@ -2076,16 +2080,6 @@
<context context-type="linenumber">264,266</context>
</context-group>
</trans-unit>
<trans-unit id="bc4c61d3713989e3c8c6610fca3ea1ca1cb19edb" datatype="html">
<source>Value</source>
<target>Verdi</target>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/block-overview-tooltip/block-overview-tooltip.component.html</context>
<context context-type="linenumber">18</context>
</context-group>
<note priority="1" from="description">Transaction value</note>
<note priority="1" from="meaning">transaction.value</note>
</trans-unit>
<trans-unit id="cb1b52c13b95fa29ea4044f2bbe0ac623b890c80" datatype="html">
<source>Fee</source>
<target>Avgift</target>

View File

@ -878,6 +878,10 @@
<context context-type="sourcefile">src/app/bisq/bisq-transactions/bisq-transactions.component.html</context>
<context context-type="linenumber">20,21</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/block-overview-tooltip/block-overview-tooltip.component.html</context>
<context context-type="linenumber">18</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/dashboard/dashboard.component.html</context>
<context context-type="linenumber">124,125</context>
@ -1263,14 +1267,14 @@
<source>Trades</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/bisq/lightweight-charts-area/lightweight-charts-area.component.ts</context>
<context context-type="linenumber">90</context>
<context context-type="linenumber">99</context>
</context-group>
</trans-unit>
<trans-unit id="bisq-graph-volume" datatype="html">
<source>Volume</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/bisq/lightweight-charts-area/lightweight-charts-area.component.ts</context>
<context context-type="linenumber">91</context>
<context context-type="linenumber">100</context>
</context-group>
</trans-unit>
<trans-unit id="4b137ec8bf73a47063740b75c0c40d5fd3c48015" datatype="html">
@ -1918,15 +1922,6 @@
<context context-type="linenumber">264,266</context>
</context-group>
</trans-unit>
<trans-unit id="bc4c61d3713989e3c8c6610fca3ea1ca1cb19edb" datatype="html">
<source>Value</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/components/block-overview-tooltip/block-overview-tooltip.component.html</context>
<context context-type="linenumber">18</context>
</context-group>
<note priority="1" from="description">Transaction value</note>
<note priority="1" from="meaning">transaction.value</note>
</trans-unit>
<trans-unit id="cb1b52c13b95fa29ea4044f2bbe0ac623b890c80" datatype="html">
<source>Fee</source>
<context-group purpose="location">

View File

@ -82,11 +82,11 @@ pkg install -y zsh sudo git screen curl wget neovim rsync nginx openssl openssh-
### Node.js + npm
Build Node.js v16.15 and npm v8 from source using `nvm`:
Build Node.js v16.16.0 and npm v8 from source using `nvm`:
```
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | zsh
source $HOME/.zshrc
nvm install v16.15.0
nvm install v16.16.0 --shared-zlib
nvm alias default node
```

View File

@ -647,193 +647,193 @@ ext4CreateDir()
# does bitcoin exist?
##########
# dialog #
##########
: ${DIALOG=dialog}
: ${DIALOG_OK=0}
: ${DIALOG_CANCEL=1}
: ${DIALOG_HELP=2}
: ${DIALOG_EXTRA=3}
: ${DIALOG_ITEM_HELP=4}
: ${DIALOG_ESC=255}
: ${SIG_OFFNE=0}
: ${SIG_HUP=1}
: ${SIG_INT=2}
: ${SIG_QUIT=3}
: ${SIG_KILL=9}
: ${SIG_TERM=15}
input=`tempfile 2>/dev/null` || input=/tmp/input$$
output=`tempfile 2>/dev/null` || output=/tmp/test$$
trap "rm -f $input $output" $SIG_OFFNE $SIG_HUP $SIG_INT $SIG_TRAP $SIG_TERM
DIALOG_ERROR=254
export DIALOG_ERROR
backtitle="Mempool Fullnode Installer"
title="Mempool Fullnode Installer"
returncode=0
#################
# dialog part 1 #
#################
$CUT >$input <<-EOF
Tor:Enable Tor v3 HS Onion:ON
Certbot:Enable HTTPS using Certbot:ON
Mainnet:Enable Bitcoin Mainnet:ON
Mainnet-Minfee:Enable Bitcoin Mainnet Minfee:ON
Testnet:Enable Bitcoin Testnet:ON
Liquid:Enable Elements Liquid:ON
Bisq:Enable Bisq:ON
Lightmode:Enable Electrs Lightmode to save disk space:ON
Smalldisk:Disable Electrs Compaction to save disk space:ON
Firewall:Enable Firewall:ON
EOF
cat $input | sed -e 's/^/"/' -e 's/:/" "/g' -e 's/$/"/' >$output
cat $output >$input
$DIALOG --backtitle "${backtitle}" \
--title "${title}" "$@" \
--checklist "Toggle the features below to configure your fullnode:\n" \
20 80 10 \
--file $input 2> $output
retval=$?
tempfile=$output
if [ $retval != $DIALOG_OK ];then
echo "Installation aborted."
exit 1
fi
if grep Tor $tempfile >/dev/null 2>&1;then
TOR_INSTALL=ON
else
TOR_INSTALL=OFF
fi
if grep Certbot $tempfile >/dev/null 2>&1;then
CERTBOT_INSTALL=ON
else
CERTBOT_INSTALL=OFF
fi
if grep Mainnet $tempfile >/dev/null 2>&1;then
BITCOIN_MAINNET_ENABLE=ON
else
BITCOIN_MAINNET_ENABLE=OFF
fi
if grep Mainnet-Minfee $tempfile >/dev/null 2>&1;then
BITCOIN_MAINNET_MINFEE_ENABLE=ON
else
BITCOIN_MAINNET_MINFEE_ENABLE=OFF
fi
if grep Testnet $tempfile >/dev/null 2>&1;then
BITCOIN_TESTNET_ENABLE=ON
else
BITCOIN_TESTNET_ENABLE=OFF
fi
if grep Liquid $tempfile >/dev/null 2>&1;then
ELEMENTS_INSTALL=ON
ELEMENTS_LIQUID_ENABLE=ON
else
ELEMENTS_INSTALL=OFF
ELEMENTS_LIQUID_ENABLE=OFF
fi
if grep Bisq $tempfile >/dev/null 2>&1;then
BISQ_INSTALL=ON
BISQ_MAINNET_ENABLE=ON
else
BISQ_INSTALL=OFF
BISQ_MAINNET_ENABLE=OFF
fi
if grep Lightmode $tempfile >/dev/null 2>&1;then
BITCOIN_ELECTRS_LIGHT_MODE=ON
else
BITCOIN_ELECTRS_LIGHT_MODE=OFF
fi
if grep Smalldisk $tempfile >/dev/null 2>&1;then
BITCOIN_ELECTRS_LIGHT_MODE=ON
else
BITCOIN_ELECTRS_LIGHT_MODE=OFF
fi
#################
# dialog part 2 #
#################
$DIALOG --cr-wrap \
--title "INPUT BOX" --clear \
--inputbox "$@" \
"Enter the FQDN hostname for obtaining an SSL certificate using Certbot:" 0 0 "${HOSTNAME}" 2> $tempfile
HOSTNAME=$(cat $tempfile)
#################
# dialog part 3 #
#################
# --form text height width formheight
# [ label y x item y x flen ilen ]
#"BISQ_BLOCKNOTIFY_HOST" 0 1 "${BISQ_BLOCKNOTIFY_HOST}" 0 30 0 0 \
$DIALOG --ok-label "Submit" \
--backtitle "$backtitle" "$@" \
--form "Your fullnode will be installed as follows:" 0 0 0 \
"BISQ_LATEST_RELEASE" 1 1 "${BISQ_LATEST_RELEASE}" 1 35 35 0 \
"BISQ_REPO_BRANCH" 2 1 "${BISQ_REPO_BRANCH}" 2 35 35 0 \
"BISQ_REPO_NAME" 3 1 "${BISQ_REPO_NAME}" 3 35 35 0 \
"BISQ_REPO_URL" 4 1 "${BISQ_REPO_URL}" 4 35 35 0 \
"BITCOIN_ELECTRS_LATEST_RELEASE" 5 1 "${BITCOIN_ELECTRS_LATEST_RELEASE}" 5 35 35 0 \
"BITCOIN_ELECTRS_LIGHT_MODE" 6 1 "${BITCOIN_ELECTRS_LIGHT_MODE}" 6 35 35 0 \
"BITCOIN_ELECTRS_REPO_BRANCH" 7 1 "${BITCOIN_ELECTRS_REPO_BRANCH}" 7 35 35 0 \
"BITCOIN_ELECTRS_REPO_NAME" 8 1 "${BITCOIN_ELECTRS_REPO_NAME}" 8 35 35 0 \
"BITCOIN_ELECTRS_REPO_URL" 9 1 "${BITCOIN_ELECTRS_REPO_URL}" 9 35 35 0 \
"BITCOIN_LATEST_RELEASE" 10 1 "${BITCOIN_LATEST_RELEASE}" 10 35 35 0 \
"BITCOIN_MAINNET_ENABLE" 11 1 "${BITCOIN_MAINNET_ENABLE}" 11 35 35 0 \
"BITCOIN_REPO_BRANCH" 12 1 "${BITCOIN_REPO_BRANCH}" 12 35 35 0 \
"BITCOIN_REPO_NAME" 13 1 "${BITCOIN_REPO_NAME}" 13 35 35 0 \
"BITCOIN_REPO_URL" 14 1 "${BITCOIN_REPO_URL}" 14 35 35 0 \
"BITCOIN_TESTNET_ENABLE" 15 1 "${BITCOIN_TESTNET_ENABLE}" 15 35 35 0 \
"ELEMENTS_INSTALL" 16 1 "${ELEMENTS_INSTALL}" 16 35 35 0 \
"ELEMENTS_LATEST_RELEASE" 17 1 "${ELEMENTS_LATEST_RELEASE}" 17 35 35 0 \
"ELEMENTS_LIQUID_ENABLE" 18 1 "${ELEMENTS_LIQUID_ENABLE}" 18 35 35 0 \
"ELEMENTS_REPO_BRANCH" 19 1 "${ELEMENTS_REPO_BRANCH}" 19 35 35 0 \
"ELEMENTS_REPO_NAME" 20 1 "${ELEMENTS_REPO_NAME}" 20 35 35 0 \
"ELEMENTS_REPO_URL" 21 1 "${ELEMENTS_REPO_URL}" 21 35 35 0 \
"MEMPOOL_LATEST_RELEASE" 22 1 "${MEMPOOL_LATEST_RELEASE}" 22 35 35 0 \
"MEMPOOL_LIQUID_HTTP_HOST" 23 1 "${MEMPOOL_LIQUID_HTTP_HOST}" 23 35 35 0 \
"MEMPOOL_LIQUID_HTTP_PORT" 24 1 "${MEMPOOL_LIQUID_HTTP_PORT}" 24 35 35 0 \
"MEMPOOL_MAINNET_HTTP_HOST" 25 1 "${MEMPOOL_MAINNET_HTTP_HOST}" 25 35 35 0 \
"MEMPOOL_MAINNET_HTTP_PORT" 26 1 "${MEMPOOL_MAINNET_HTTP_PORT}" 26 35 35 0 \
"MEMPOOL_REPO_BRANCH" 27 1 "${MEMPOOL_REPO_BRANCH}" 27 35 35 0 \
"MEMPOOL_REPO_NAME" 28 1 "${MEMPOOL_REPO_NAME}" 28 35 35 0 \
"MEMPOOL_REPO_URL" 29 1 "${MEMPOOL_REPO_URL}" 29 35 35 0 \
"MEMPOOL_TESTNET_HTTP_HOST" 30 1 "${MEMPOOL_TESTNET_HTTP_HOST}" 30 35 35 0 \
"MEMPOOL_TESTNET_HTTP_PORT" 31 1 "${MEMPOOL_TESTNET_HTTP_PORT}" 31 35 35 0 \
"MEMPOOL_TOR_HS" 32 1 "${MEMPOOL_TOR_HS}" 32 35 35 0 \
"HOSTNAME" 33 1 "${HOSTNAME}" 33 35 35 0 \
"TOR_INSTALL" 34 1 "${TOR_INSTALL}" 34 35 35 0 \
"CERTBOT_INSTALL" 35 1 "${CERTBOT_INSTALL}" 35 35 35 0 \
2> $tempfile
retval=$?
if [ $retval != $DIALOG_OK ];then
echo "Installation aborted."
exit 1
fi
###########
## dialog #
###########
#
#: ${DIALOG=dialog}
#
#: ${DIALOG_OK=0}
#: ${DIALOG_CANCEL=1}
#: ${DIALOG_HELP=2}
#: ${DIALOG_EXTRA=3}
#: ${DIALOG_ITEM_HELP=4}
#: ${DIALOG_ESC=255}
#
#: ${SIG_OFFNE=0}
#: ${SIG_HUP=1}
#: ${SIG_INT=2}
#: ${SIG_QUIT=3}
#: ${SIG_KILL=9}
#: ${SIG_TERM=15}
#
#input=`tempfile 2>/dev/null` || input=/tmp/input$$
#output=`tempfile 2>/dev/null` || output=/tmp/test$$
#trap "rm -f $input $output" $SIG_OFFNE $SIG_HUP $SIG_INT $SIG_TRAP $SIG_TERM
#
#DIALOG_ERROR=254
#export DIALOG_ERROR
#
#backtitle="Mempool Fullnode Installer"
#title="Mempool Fullnode Installer"
#returncode=0
#
##################
## dialog part 1 #
##################
#
#$CUT >$input <<-EOF
#Tor:Enable Tor v3 HS Onion:ON
#Certbot:Enable HTTPS using Certbot:ON
#Mainnet:Enable Bitcoin Mainnet:ON
#Mainnet-Minfee:Enable Bitcoin Mainnet Minfee:ON
#Testnet:Enable Bitcoin Testnet:ON
#Liquid:Enable Elements Liquid:ON
#Bisq:Enable Bisq:ON
#Lightmode:Enable Electrs Lightmode to save disk space:ON
#Smalldisk:Disable Electrs Compaction to save disk space:ON
#Firewall:Enable Firewall:ON
#EOF
#
#cat $input | sed -e 's/^/"/' -e 's/:/" "/g' -e 's/$/"/' >$output
#cat $output >$input
#
#$DIALOG --backtitle "${backtitle}" \
# --title "${title}" "$@" \
# --checklist "Toggle the features below to configure your fullnode:\n" \
# 20 80 10 \
# --file $input 2> $output
#
#retval=$?
#
#tempfile=$output
#if [ $retval != $DIALOG_OK ];then
# echo "Installation aborted."
# exit 1
#fi
#
#if grep Tor $tempfile >/dev/null 2>&1;then
# TOR_INSTALL=ON
#else
# TOR_INSTALL=OFF
#fi
#
#if grep Certbot $tempfile >/dev/null 2>&1;then
# CERTBOT_INSTALL=ON
#else
# CERTBOT_INSTALL=OFF
#fi
#
#if grep Mainnet $tempfile >/dev/null 2>&1;then
# BITCOIN_MAINNET_ENABLE=ON
#else
# BITCOIN_MAINNET_ENABLE=OFF
#fi
#
#if grep Mainnet-Minfee $tempfile >/dev/null 2>&1;then
# BITCOIN_MAINNET_MINFEE_ENABLE=ON
#else
# BITCOIN_MAINNET_MINFEE_ENABLE=OFF
#fi
#
#if grep Testnet $tempfile >/dev/null 2>&1;then
# BITCOIN_TESTNET_ENABLE=ON
#else
# BITCOIN_TESTNET_ENABLE=OFF
#fi
#
#if grep Liquid $tempfile >/dev/null 2>&1;then
# ELEMENTS_INSTALL=ON
# ELEMENTS_LIQUID_ENABLE=ON
#else
# ELEMENTS_INSTALL=OFF
# ELEMENTS_LIQUID_ENABLE=OFF
#fi
#
#if grep Bisq $tempfile >/dev/null 2>&1;then
# BISQ_INSTALL=ON
# BISQ_MAINNET_ENABLE=ON
#else
# BISQ_INSTALL=OFF
# BISQ_MAINNET_ENABLE=OFF
#fi
#
#if grep Lightmode $tempfile >/dev/null 2>&1;then
# BITCOIN_ELECTRS_LIGHT_MODE=ON
#else
# BITCOIN_ELECTRS_LIGHT_MODE=OFF
#fi
#
#if grep Smalldisk $tempfile >/dev/null 2>&1;then
# BITCOIN_ELECTRS_LIGHT_MODE=ON
#else
# BITCOIN_ELECTRS_LIGHT_MODE=OFF
#fi
#
##################
## dialog part 2 #
##################
#
#$DIALOG --cr-wrap \
# --title "INPUT BOX" --clear \
# --inputbox "$@" \
#"Enter the FQDN hostname for obtaining an SSL certificate using Certbot:" 0 0 "${HOSTNAME}" 2> $tempfile
#HOSTNAME=$(cat $tempfile)
#
##################
## dialog part 3 #
##################
#
## --form text height width formheight
## [ label y x item y x flen ilen ]
# #"BISQ_BLOCKNOTIFY_HOST" 0 1 "${BISQ_BLOCKNOTIFY_HOST}" 0 30 0 0 \
#
#$DIALOG --ok-label "Submit" \
# --backtitle "$backtitle" "$@" \
# --form "Your fullnode will be installed as follows:" 0 0 0 \
# "BISQ_LATEST_RELEASE" 1 1 "${BISQ_LATEST_RELEASE}" 1 35 35 0 \
# "BISQ_REPO_BRANCH" 2 1 "${BISQ_REPO_BRANCH}" 2 35 35 0 \
# "BISQ_REPO_NAME" 3 1 "${BISQ_REPO_NAME}" 3 35 35 0 \
# "BISQ_REPO_URL" 4 1 "${BISQ_REPO_URL}" 4 35 35 0 \
# "BITCOIN_ELECTRS_LATEST_RELEASE" 5 1 "${BITCOIN_ELECTRS_LATEST_RELEASE}" 5 35 35 0 \
# "BITCOIN_ELECTRS_LIGHT_MODE" 6 1 "${BITCOIN_ELECTRS_LIGHT_MODE}" 6 35 35 0 \
# "BITCOIN_ELECTRS_REPO_BRANCH" 7 1 "${BITCOIN_ELECTRS_REPO_BRANCH}" 7 35 35 0 \
# "BITCOIN_ELECTRS_REPO_NAME" 8 1 "${BITCOIN_ELECTRS_REPO_NAME}" 8 35 35 0 \
# "BITCOIN_ELECTRS_REPO_URL" 9 1 "${BITCOIN_ELECTRS_REPO_URL}" 9 35 35 0 \
# "BITCOIN_LATEST_RELEASE" 10 1 "${BITCOIN_LATEST_RELEASE}" 10 35 35 0 \
# "BITCOIN_MAINNET_ENABLE" 11 1 "${BITCOIN_MAINNET_ENABLE}" 11 35 35 0 \
# "BITCOIN_REPO_BRANCH" 12 1 "${BITCOIN_REPO_BRANCH}" 12 35 35 0 \
# "BITCOIN_REPO_NAME" 13 1 "${BITCOIN_REPO_NAME}" 13 35 35 0 \
# "BITCOIN_REPO_URL" 14 1 "${BITCOIN_REPO_URL}" 14 35 35 0 \
# "BITCOIN_TESTNET_ENABLE" 15 1 "${BITCOIN_TESTNET_ENABLE}" 15 35 35 0 \
# "ELEMENTS_INSTALL" 16 1 "${ELEMENTS_INSTALL}" 16 35 35 0 \
# "ELEMENTS_LATEST_RELEASE" 17 1 "${ELEMENTS_LATEST_RELEASE}" 17 35 35 0 \
# "ELEMENTS_LIQUID_ENABLE" 18 1 "${ELEMENTS_LIQUID_ENABLE}" 18 35 35 0 \
# "ELEMENTS_REPO_BRANCH" 19 1 "${ELEMENTS_REPO_BRANCH}" 19 35 35 0 \
# "ELEMENTS_REPO_NAME" 20 1 "${ELEMENTS_REPO_NAME}" 20 35 35 0 \
# "ELEMENTS_REPO_URL" 21 1 "${ELEMENTS_REPO_URL}" 21 35 35 0 \
# "MEMPOOL_LATEST_RELEASE" 22 1 "${MEMPOOL_LATEST_RELEASE}" 22 35 35 0 \
# "MEMPOOL_LIQUID_HTTP_HOST" 23 1 "${MEMPOOL_LIQUID_HTTP_HOST}" 23 35 35 0 \
# "MEMPOOL_LIQUID_HTTP_PORT" 24 1 "${MEMPOOL_LIQUID_HTTP_PORT}" 24 35 35 0 \
# "MEMPOOL_MAINNET_HTTP_HOST" 25 1 "${MEMPOOL_MAINNET_HTTP_HOST}" 25 35 35 0 \
# "MEMPOOL_MAINNET_HTTP_PORT" 26 1 "${MEMPOOL_MAINNET_HTTP_PORT}" 26 35 35 0 \
# "MEMPOOL_REPO_BRANCH" 27 1 "${MEMPOOL_REPO_BRANCH}" 27 35 35 0 \
# "MEMPOOL_REPO_NAME" 28 1 "${MEMPOOL_REPO_NAME}" 28 35 35 0 \
# "MEMPOOL_REPO_URL" 29 1 "${MEMPOOL_REPO_URL}" 29 35 35 0 \
# "MEMPOOL_TESTNET_HTTP_HOST" 30 1 "${MEMPOOL_TESTNET_HTTP_HOST}" 30 35 35 0 \
# "MEMPOOL_TESTNET_HTTP_PORT" 31 1 "${MEMPOOL_TESTNET_HTTP_PORT}" 31 35 35 0 \
# "MEMPOOL_TOR_HS" 32 1 "${MEMPOOL_TOR_HS}" 32 35 35 0 \
# "HOSTNAME" 33 1 "${HOSTNAME}" 33 35 35 0 \
# "TOR_INSTALL" 34 1 "${TOR_INSTALL}" 34 35 35 0 \
# "CERTBOT_INSTALL" 35 1 "${CERTBOT_INSTALL}" 35 35 35 0 \
#2> $tempfile
#
#retval=$?
#
#if [ $retval != $DIALOG_OK ];then
# echo "Installation aborted."
# exit 1
#fi
############################
# START DOING ACTUAL STUFF #
@ -842,8 +842,6 @@ fi
date
echo "[*] Mempool installation script for ${OS}"
set -x
###################################
# create filesystems if necessary #
###################################
@ -907,7 +905,7 @@ echo "[*] Installing nvm.sh from GitHub"
osSudo "${MEMPOOL_USER}" sh -c 'curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | zsh'
echo "[*] Building NodeJS via nvm.sh"
osSudo "${MEMPOOL_USER}" zsh -c 'source ~/.zshrc ; nvm install v16.15.0'
osSudo "${MEMPOOL_USER}" zsh -c 'source ~/.zshrc ; nvm install v16.16.0 --shared-zlib'
####################
# Tor installation #
@ -1613,7 +1611,10 @@ EOF
;;
esac
##### Build Mempool
echo "[*] Build Mempool"
osSudo "${MEMPOOL_USER}" sh -c "cd ${MEMPOOL_HOME} && ./upgrade"
@ -1692,8 +1693,21 @@ esac
##### finish
echo 'Please reboot to start all the services.'
case $OS in
FreeBSD)
;;
Debian)
echo "This are the generated Tor addresses:"
echo "${NGINX_MEMPOOL_ONION}"
echo "${NGINX_BISQ_ONION}"
echo "${NGINX_LIQUID_ONION}"
;;
esac
echo
echo 'Please reboot to start all the services.'
echo '[*] Done!'
exit 0