Add Fulcrum to Mempool (#46)
* Bump version to 3.2.1.3 and add Fulcrum indexer Updated version to 3.2.1.3 and added Fulcrum as an optional indexer. * Add indexer configuration * Update address lookup instructions for Electrs and Fulcrum * Refactor getConfig.ts for add fulcrum * Update to v3.2.1.3 with fulcrum * Update setConfig to support indexer selection Enhanced CustomConfig to include indexer properties and updated dependency handling for both indexer and lightning types. * Update manifest.yaml sounds good to me Co-authored-by: Dominion5254 <musashidisciple@proton.me> * Update manifest.yaml * Add 3.2.1.3 migrations * Rollback to old migration.ts and add 3.2.1.3 as current Removed unused indexer matching logic and related comments. * fucrum migration --------- Co-authored-by: Dominion5254 <musashidisciple@proton.me>
This commit is contained in:
parent
37b342f8dd
commit
5f7d71a974
@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
set -ea
|
||||
|
||||
_term() {
|
||||
echo "Caught SIGTERM signal!"
|
||||
_term() {
|
||||
echo "Caught SIGTERM signal!"
|
||||
kill -TERM "$backend_process" 2>/dev/null
|
||||
kill -TERM "$db_process" 2>/dev/null
|
||||
kill -TERM "$frontend_process" 2>/dev/null
|
||||
@ -65,9 +65,15 @@ elif [ "$(yq e ".lightning.type" /root/start9/config.yaml)" = "cln" ]; then
|
||||
echo "Running on Core Lightning..."
|
||||
fi
|
||||
|
||||
if [ "$(yq e ".enable-electrs" /root/start9/config.yaml)" = "true" ]; then
|
||||
# Allow user to choose between Electrs, Fulcrum as Indexer
|
||||
if [ "$(yq e ".indexer.type" /root/start9/config.yaml)" = "electrs" ]; then
|
||||
sed -i 's/ELECTRUM_HOST:=127.0.0.1/ELECTRUM_HOST:=electrs.embassy/' start.sh
|
||||
sed -i 's/ELECTRUM_PORT:=50002/ELECTRUM_PORT:=50001/' start.sh
|
||||
echo "Running with Electrs..."
|
||||
elif [ "$(yq e ".indexer.type" /root/start9/config.yaml)" = "fulcrum" ]; then
|
||||
sed -i 's/ELECTRUM_HOST:=127.0.0.1/ELECTRUM_HOST:=fulcrum.embassy/' start.sh
|
||||
sed -i 's/ELECTRUM_PORT:=50002/ELECTRUM_PORT:=50001/' start.sh
|
||||
echo "Running with Fulcrum..."
|
||||
else
|
||||
# configure mempool to use just a bitcoind backend
|
||||
sed -i '/^node \/backend\/dist\/index.js/i jq \x27.MEMPOOL.BACKEND="none"\x27 \/backend\/mempool-config.json > \/backend\/mempool-config.json.tmp && mv \/backend\/mempool-config.json.tmp \/backend\/mempool-config.json' start.sh
|
||||
@ -75,7 +81,6 @@ else
|
||||
fi
|
||||
|
||||
# DATABASE SETUP
|
||||
|
||||
MYSQL_DATADIR="/var/lib/mysql"
|
||||
UPGRADE_MARKER="$MYSQL_DATADIR/.upgrade_done"
|
||||
MYSQL_DIR="/var/run/mysqld"
|
||||
@ -136,7 +141,7 @@ EOF
|
||||
fi
|
||||
fi
|
||||
|
||||
/usr/sbin/mysqld --user=mysql --bootstrap --verbose=0 --skip-name-resolve --skip-networking=0 < $tfile
|
||||
/usr/sbin/mysqld --user=mysql --datadir="$MYSQL_DATADIR" --bootstrap --verbose=0 --skip-name-resolve --skip-networking=0 < $tfile
|
||||
|
||||
rm -f $tfile
|
||||
|
||||
@ -197,7 +202,6 @@ backend_process=$!
|
||||
|
||||
echo 'All processes initalized'
|
||||
|
||||
|
||||
# SIGTERM HANDLING
|
||||
trap _term SIGTERM
|
||||
|
||||
|
||||
@ -20,9 +20,9 @@ The Mining tab provides network information about bitcoin mining statistics and
|
||||
|
||||
## Address Lookups
|
||||
|
||||
To enable address lookups, toggle on the "Enable Electrs Address Lookups" option in the configuration menu.
|
||||
To enable address lookups, toggle on the "Enable Electrs or Fulcrum Address Lookups" option in the configuration menu.
|
||||
|
||||
You will need electrs to be installed and synced before this feature will work. Also, lookups may be slow or time out altogether while the service is still warming up, or if there are too many other things running on your system.
|
||||
You will need electrs or fulcrum to be installed and synced before this feature will work. Also, lookups may be slow or time out altogether while the service is still warming up, or if there are too many other things running on your system.
|
||||
|
||||
## Acceleration
|
||||
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
id: mempool
|
||||
title: Mempool
|
||||
version: 3.2.1.2
|
||||
version: 3.2.1.3
|
||||
release-notes: |
|
||||
* Update dependency allowed versions for bitcoind and lnd
|
||||
* Add Fulcrum as optinal indexer
|
||||
license: AGPL
|
||||
wrapper-repo: "https://github.com/Start9Labs/mempool-wrapper"
|
||||
upstream-repo: "https://github.com/mempool/mempool"
|
||||
@ -71,12 +71,18 @@ dependencies:
|
||||
type: script
|
||||
auto-configure:
|
||||
type: script
|
||||
fulcrum:
|
||||
version: '>=1.11.0 <3.0.0'
|
||||
requirement:
|
||||
type: 'opt-in'
|
||||
how: Set Indexer to Fulcrum in the config
|
||||
description: Used for fast scan of addresses and indexing for deep wallets.
|
||||
electrs:
|
||||
version: ">=0.9.6 <0.12.0"
|
||||
requirement:
|
||||
type: "opt-out"
|
||||
how: Set Enable Electrs to Disabled in the config
|
||||
description: Used to provide an index for address lookups
|
||||
type: "opt-in"
|
||||
how: Set Indexer to Electrs in the config
|
||||
description: A more stable, but less performant indexer.
|
||||
lnd:
|
||||
version: ">=0.14.3 <0.21.0"
|
||||
description: Used to communicate with the Lightning Network.
|
||||
|
||||
@ -11,15 +11,15 @@ export const getConfig: T.ExpectedExports.getConfig = compat.getConfig({
|
||||
"interface": "main",
|
||||
},
|
||||
"bitcoin-user": {
|
||||
"type": "pointer",
|
||||
"name": "RPC Username",
|
||||
"description": "The username for Bitcoin Core's RPC interface",
|
||||
"subtype": "package",
|
||||
"package-id": "bitcoind",
|
||||
"target": "config",
|
||||
"multi": false,
|
||||
"selector": "$.rpc.username",
|
||||
},
|
||||
"type": "pointer",
|
||||
"name": "RPC Username",
|
||||
"description": "The username for Bitcoin Core's RPC interface",
|
||||
"subtype": "package",
|
||||
"package-id": "bitcoind",
|
||||
"target": "config",
|
||||
"multi": false,
|
||||
"selector": "$.rpc.username",
|
||||
},
|
||||
"bitcoin-password": {
|
||||
"type": "pointer",
|
||||
"name": "RPC Password",
|
||||
@ -34,7 +34,7 @@ export const getConfig: T.ExpectedExports.getConfig = compat.getConfig({
|
||||
"type": "union",
|
||||
"name": "Lightning Node",
|
||||
"description":
|
||||
"The Lightning node you will connect to in order to serve network data to the Lightning tab in Mempool",
|
||||
"The Lightning node you will connect to in order to serve network data to the Lightning tab in Mempool",
|
||||
"tag": {
|
||||
"id": "type",
|
||||
"name": "Select Lightning Node",
|
||||
@ -44,7 +44,7 @@ export const getConfig: T.ExpectedExports.getConfig = compat.getConfig({
|
||||
"cln": "Core Lightning",
|
||||
},
|
||||
"description":
|
||||
"The Lightning node you will connect to in order to serve network data to the Lightning tab in Mempool",
|
||||
"The Lightning node you will connect to in order to serve network data to the Lightning tab in Mempool",
|
||||
},
|
||||
"default": "none",
|
||||
"variants": {
|
||||
@ -53,10 +53,25 @@ export const getConfig: T.ExpectedExports.getConfig = compat.getConfig({
|
||||
"cln": {},
|
||||
}
|
||||
},
|
||||
"enable-electrs": {
|
||||
"name": "Enable Electrs Address Lookups",
|
||||
"description": "Enables address lookups via an internal electrs instance",
|
||||
"type": "boolean",
|
||||
"default": true,
|
||||
"indexer": {
|
||||
"name": "Indexer Type",
|
||||
"description": "Select the type of indexer to use for address lookups",
|
||||
"type": "union",
|
||||
"tag": {
|
||||
"id": "type",
|
||||
"name": "Select Indexer",
|
||||
"variant-names": {
|
||||
"none": "Disabled",
|
||||
"electrs": "Electrs",
|
||||
"fulcrum": "Fulcrum",
|
||||
},
|
||||
"description": "Select the Bitcoin indexer you want to use for address lookups",
|
||||
},
|
||||
"default": "none",
|
||||
"variants": {
|
||||
"none": {},
|
||||
"electrs": {},
|
||||
"fulcrum": {},
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@ -2,7 +2,7 @@ import { types as T, compat, matches } from "../deps.ts";
|
||||
|
||||
const { shape, boolean, string } = matches;
|
||||
|
||||
const current = "3.2.1.2";
|
||||
const current = "3.2.1.3";
|
||||
|
||||
export const migration: T.ExpectedExports.migration = (
|
||||
effects: T.Effects,
|
||||
@ -93,6 +93,42 @@ export const migration: T.ExpectedExports.migration = (
|
||||
throw new Error("Downgrades are prohibited from this version");
|
||||
},
|
||||
},
|
||||
"3.2.1.3": {
|
||||
up: compat.migrations.updateConfig(
|
||||
(config: any) => {
|
||||
if (config["enable-electrs"]) {
|
||||
config.indexer = { type: "electrs" };
|
||||
} else {
|
||||
config.indexer = { type: "none" };
|
||||
}
|
||||
delete config["enable-electrs"];
|
||||
return config;
|
||||
},
|
||||
true,
|
||||
{ version: "3.2.1.3", type: "up" }
|
||||
),
|
||||
down: compat.migrations.updateConfig(
|
||||
(config) => {
|
||||
if (
|
||||
matches
|
||||
.shape({
|
||||
indexer: matches.shape({ type: matches.any }),
|
||||
})
|
||||
.test(config)
|
||||
) {
|
||||
if (config.indexer.type === "electrs") {
|
||||
config["enable-electrs"] = true;
|
||||
} else {
|
||||
config["enable-electrs"] = false;
|
||||
}
|
||||
}
|
||||
delete config.indexer;
|
||||
return config;
|
||||
},
|
||||
true,
|
||||
{ version: "3.2.1.3", type: "down" }
|
||||
),
|
||||
},
|
||||
},
|
||||
current
|
||||
)(effects, version, ...args);
|
||||
|
||||
@ -1,29 +1,43 @@
|
||||
import { compat, types as T } from "../deps.ts";
|
||||
|
||||
// Define a custom type for T.Config to include the 'lightning' property with a 'type' property
|
||||
// Define a custom type for T.Config to include the 'lightning' and 'indexer' properties
|
||||
interface CustomConfig extends T.Config {
|
||||
lightning?: {
|
||||
type?: string;
|
||||
type?: string; // Lightning node type (lnd, cln, etc.)
|
||||
};
|
||||
indexer?: {
|
||||
type?: string; // Indexer type (electrs, fulcrum)
|
||||
};
|
||||
}
|
||||
|
||||
// deno-lint-ignore require-await
|
||||
export const setConfig: T.ExpectedExports.setConfig = async (
|
||||
effects: T.Effects,
|
||||
newConfig: CustomConfig
|
||||
) => {
|
||||
const dependsOnElectrs: { [key: string]: string[] } = newConfig?.[
|
||||
"enable-electrs"
|
||||
]
|
||||
// Set dependencies based on indexer type (Electrs or Fulcrum)
|
||||
const dependsOnElectrs: { [key: string]: string[] } = newConfig?.indexer?.type === "electrs"
|
||||
? { electrs: ["synced"] }
|
||||
: {};
|
||||
|
||||
// add two const depsLnd and depsCln for the new lightning type string in getConfig
|
||||
const depsLnd: { [key: string]: string[] } = newConfig?.lightning?.type === "lnd" ? {lnd: []} : {};
|
||||
const depsCln: { [key: string]: string[] } = newConfig?.lightning?.type === "cln" ? {"c-lightning": []} : {};
|
||||
|
||||
const dependsOnFulcrum: { [key: string]: string[] } = newConfig?.indexer?.type === "fulcrum"
|
||||
? { fulcrum: ["synced"] }
|
||||
: {};
|
||||
|
||||
// Set dependencies based on lightning type (LND or CLN)
|
||||
const depsLnd: { [key: string]: string[] } = newConfig?.lightning?.type === "lnd"
|
||||
? { lnd: [] }
|
||||
: {};
|
||||
|
||||
const depsCln: { [key: string]: string[] } = newConfig?.lightning?.type === "cln"
|
||||
? { "c-lightning": [] }
|
||||
: {};
|
||||
|
||||
// Return the final configuration with all dependencies
|
||||
return compat.setConfig(effects, newConfig, {
|
||||
...dependsOnElectrs,
|
||||
...depsLnd,
|
||||
...depsCln,
|
||||
...dependsOnElectrs, // Electrs dependencies (if applicable)
|
||||
...dependsOnFulcrum, // Fulcrum dependencies (if applicable)
|
||||
...depsLnd, // LND dependencies (if applicable)
|
||||
...depsCln, // CLN dependencies (if applicable)
|
||||
});
|
||||
};
|
||||
|
||||
Loading…
Reference in New Issue
Block a user