From 09a11b1c7afb99c4eb2ea239e62e464c6c1f8a6a Mon Sep 17 00:00:00 2001 From: wiz Date: Sat, 30 Sep 2023 10:32:36 +0900 Subject: [PATCH] ops: Set UTXO and history limit based on hostname --- electrs-start-mainnet | 20 +++++++++++++++++--- electrs-start-signet | 16 +++++++++++++++- electrs-start-testnet | 20 +++++++++++++++++--- 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/electrs-start-mainnet b/electrs-start-mainnet index e1a6b3c4..7bb10e59 100755 --- a/electrs-start-mainnet +++ b/electrs-start-mainnet @@ -3,11 +3,23 @@ #export PATH="${HOME}/.cargo/bin:${PATH}" # don't bother making electrs.core files -ulimit -c +ulimit -c 0 # get credentials from bitcoin.conf directly -BITCOIN_RPC_USER=$(grep 'rpcuser=' ${HOME}/bitcoin.conf|cut -d = -f2|head -1) -BITCOIN_RPC_PASS=$(grep 'rpcpassword=' ${HOME}/bitcoin.conf|cut -d = -f2|head -1) +BITCOIN_RPC_USER=$(grep 'rpcuser=' "${HOME}/bitcoin.conf"|cut -d = -f2|head -1) +BITCOIN_RPC_PASS=$(grep 'rpcpassword=' "${HOME}/bitcoin.conf"|cut -d = -f2|head -1) + +# base limits +UTXOS_LIMIT=500 +ELECTRUM_TXS_LIMIT=500 + +# increase limits based on hostname +NODENAME=$(hostname|cut -d . -f1) +LOCATION=$(hostname|cut -d . -f2) +if [ "${NODENAME}" = "node201" ];then + UTXOS_LIMIT=9000 + ELECTRUM_TXS_LIMIT=9000 +fi # run in loop in case of crash until false @@ -24,6 +36,8 @@ do --cookie "${BITCOIN_RPC_USER}:${BITCOIN_RPC_PASS}" \ --cors '*' \ --address-search \ + --utxos-limit "${UTXOS_LIMIT}" \ + --electrum-txs-limit "${ELECTRUM_TXS_LIMIT}" \ -vvv sleep 1 done diff --git a/electrs-start-signet b/electrs-start-signet index 9c2b8b49..b2f695b1 100755 --- a/electrs-start-signet +++ b/electrs-start-signet @@ -3,12 +3,24 @@ #export PATH="${HOME}/.cargo/bin:${PATH}" # don't bother making electrs.core files -ulimit -c +ulimit -c 0 # get credentials from bitcoin.conf directly BITCOIN_RPC_USER=$(grep 'rpcuser=' "${HOME}/bitcoin.conf"|cut -d = -f2|head -1) BITCOIN_RPC_PASS=$(grep 'rpcpassword=' "${HOME}/bitcoin.conf"|cut -d = -f2|head -1) +# base limits +UTXOS_LIMIT=500 +ELECTRUM_TXS_LIMIT=500 + +# increase limits based on hostname +NODENAME=$(hostname|cut -d . -f1) +LOCATION=$(hostname|cut -d . -f2) +if [ "${NODENAME}" = "node201" ];then + UTXOS_LIMIT=9000 + ELECTRUM_TXS_LIMIT=9000 +fi + # run in loop in case of crash until false do @@ -25,6 +37,8 @@ do --cookie "${BITCOIN_RPC_USER}:${BITCOIN_RPC_PASS}" \ --cors '*' \ --address-search \ + --utxos-limit "${UTXOS_LIMIT}" \ + --electrum-txs-limit "${ELECTRUM_TXS_LIMIT}" \ -vvv sleep 1 done diff --git a/electrs-start-testnet b/electrs-start-testnet index 63c6e11b..95ced073 100755 --- a/electrs-start-testnet +++ b/electrs-start-testnet @@ -3,11 +3,23 @@ #export PATH="${HOME}/.cargo/bin:${PATH}" # don't bother making electrs.core files -ulimit -c +ulimit -c 0 # get credentials from bitcoin.conf directly -BITCOIN_RPC_USER=$(grep 'rpcuser=' ${HOME}/bitcoin.conf|cut -d = -f2|head -1) -BITCOIN_RPC_PASS=$(grep 'rpcpassword=' ${HOME}/bitcoin.conf|cut -d = -f2|head -1) +BITCOIN_RPC_USER=$(grep 'rpcuser=' "${HOME}/bitcoin.conf"|cut -d = -f2|head -1) +BITCOIN_RPC_PASS=$(grep 'rpcpassword=' "${HOME}/bitcoin.conf"|cut -d = -f2|head -1) + +# base limits +UTXOS_LIMIT=500 +ELECTRUM_TXS_LIMIT=500 + +# increase limits based on hostname +NODENAME=$(hostname|cut -d . -f1) +LOCATION=$(hostname|cut -d . -f2) +if [ "${NODENAME}" = "node201" ];then + UTXOS_LIMIT=9000 + ELECTRUM_TXS_LIMIT=9000 +fi # run in loop in case of crash until false @@ -25,6 +37,8 @@ do --cookie "${BITCOIN_RPC_USER}:${BITCOIN_RPC_PASS}" \ --cors '*' \ --address-search \ + --utxos-limit "${UTXOS_LIMIT}" \ + --electrum-txs-limit "${ELECTRUM_TXS_LIMIT}" \ -vvv sleep 1 done