Skip to content

Commit e5cfc11

Browse files
committed
Removed support for btc-rpc-proxy
1 parent 34ee71c commit e5cfc11

File tree

8 files changed

+11
-99
lines changed

8 files changed

+11
-99
lines changed

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
.vscode
2+
docker-images
13
electrs.s9pk
24
image.tar
35
scripts/embassy.js
4-
.vscode
5-
docker-images

Makefile

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ install: $(PKG_ID).s9pk
1515
start-cli package install $(PKG_ID).s9pk
1616

1717
clean:
18+
docker run --rm -it -v "$(shell pwd)"/configurator:/home/rust/src messense/rust-musl-cross:x86_64-musl cargo clean -q
1819
rm -rf docker-images
1920
rm -rf image.tar
2021
rm -f $(PKG_ID).s9pk
@@ -28,7 +29,7 @@ arm: docker-images/aarch64.tar scripts/embassy.js
2829
x86: docker-images/x86_64.tar scripts/embassy.js
2930
start-sdk pack
3031

31-
$(PKG_ID).s9pk: manifest.yaml instructions.md scripts/embassy.js electrs/LICENSE docker-images/aarch64.tar docker-images/x86_64.tar
32+
$(PKG_ID).s9pk: manifest.yaml instructions.md scripts/embassy.js electrs/LICENSE docker-images/x86_64.tar docker-images/aarch64.tar
3233
start-sdk pack
3334

3435
docker-images/aarch64.tar: Dockerfile docker_entrypoint.sh check-synced.sh check-electrum.sh configurator/target/aarch64-unknown-linux-musl/release/configurator $(ELECTRS_SRC)

check-synced.sh

+4-9
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ if [ "$b_type" == "bitcoind-testnet" ]; then
1414
b_rpc_port=48332
1515
e_monitoring_port=44224
1616
e_db_path=/data/db/testnet4
17-
elif [ "$b_type" == "bitcoind-proxy" ]; then
18-
b_host="btc-rpc-proxy.embassy"
19-
b_rpc_port=8332
20-
e_monitoring_port=4224
21-
e_db_path=/data/db/bitcoin
2217
else
2318
b_host="bitcoind.embassy"
2419
b_rpc_port=8332
@@ -28,7 +23,7 @@ fi
2823

2924
b_username=$(yq '.bitcoind.username' /data/start9/config.yaml)
3025
b_password=$(yq '.bitcoind.password' /data/start9/config.yaml)
31-
26+
3227
#Get blockchain info from the bitcoin rpc
3328
b_gbc_result=$(curl -sS --user $b_username:$b_password --data-binary '{"jsonrpc": "1.0", "id": "sync-hck", "method": "getblockchaininfo", "params": []}' -H 'content-type: text/plain;' http://$b_host:$b_rpc_port/ 2>&1)
3429
error_code=$?
@@ -58,18 +53,18 @@ fi
5853
#Gather keys/values from prometheus rpc:
5954
curl_res=$(curl -sS localhost:$e_monitoring_port 2>/dev/null)
6055
error_code=$?
61-
56+
6257
if [[ $error_code -ne 0 ]]; then
6358
echo "Error contacting the electrs Prometheus RPC" >&2
6459
exit 61
6560
fi
66-
61+
6762
#Determine whether we are actively doing a database compaction:
6863
#compaction_res=$(echo -e "$features_res" | grep num-running-compactions | sed "s/\s$//g" | grep " [^0]$"|awk '{print $NF}'|head -1)
6964
#^The prometheus RPC's num-running-compactions key doesn't seem to correspond to actual
7065
# compaction events, so we'll determine compaction by another, dumber but accurate method:
7166
chk_numlines=100000 #Look through the last 100,000 lines of the db LOG
72-
log_file="/data/db/bitcoin/LOG"
67+
log_file="$e_db_path/LOG"
7368
tail_log="ionice -c3 tail -$chk_numlines $log_file"
7469
compaction_job=$($tail_log|nice -n19 grep EVENT_LOG|nice -n19 grep "ManualCompaction"|nice -n19 tail -1|nice -n19 cut -d" " -f7)
7570
if [ -n "$compaction_job" ] ; then

configurator/src/main.rs

-11
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ enum BitcoinCoreConfig {
2222
username: String,
2323
password: String,
2424
},
25-
#[serde(rename = "bitcoind-proxy")]
26-
BitcoindProxy {
27-
username: String,
28-
password: String,
29-
},
3025
#[serde(rename = "bitcoind-testnet")]
3126
BitcoindTestnet {
3227
username: String,
@@ -47,12 +42,6 @@ fn main() -> Result<(), anyhow::Error> {
4742
let network = format!("{}", "bitcoin");
4843
(username, password, hostname.clone(), 8332, hostname.clone(), 8333, network.clone())
4944
}
50-
BitcoinCoreConfig::BitcoindProxy { username, password } => {
51-
let hostname = format!("{}", "btc-rpc-proxy.embassy");
52-
let p2p_hostname = format!("{}", "bitcoind.embassy");
53-
let network = format!("{}", "bitcoin");
54-
(username, password, hostname.clone(), 8332, p2p_hostname.clone(), 8333, network.clone())
55-
}
5645
BitcoinCoreConfig::BitcoindTestnet { username, password } => {
5746
let hostname = format!("{}", "bitcoind-testnet.embassy");
5847
let network = format!("{}", "testnet4");

manifest.yaml

-11
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,6 @@ dependencies:
101101
auto-configure:
102102
type: script
103103
requires-runtime-config: true
104-
btc-rpc-proxy:
105-
version: '>=0.3.2.1 <0.5.0'
106-
requirement:
107-
type: 'opt-in'
108-
how: Set "Bitcoin Core" to "Bitcoin Core"
109-
description: Provides bitcoin rpc interface needed for info about fees, blockchain, mempool, network, and transactions. Can also use bitcoind for rpc interface, or an external node for both.
110-
config:
111-
check:
112-
type: script
113-
auto-configure:
114-
type: script
115104
backup:
116105
create:
117106
type: script

scripts/services/dependencies.ts

-25
Original file line numberDiff line numberDiff line change
@@ -168,31 +168,6 @@ const bitcoindChecks: Array<Check> = [
168168
]
169169

170170
export const dependencies: T.ExpectedExports.dependencies = {
171-
'btc-rpc-proxy': {
172-
// deno-lint-ignore require-await
173-
async check(effects, configInput) {
174-
effects.info('check btc-rpc-proxy')
175-
for (const checker of proxyChecks) {
176-
const error = checker.currentError(configInput)
177-
if (error) {
178-
effects.error(`throwing error: ${error}`)
179-
return { error }
180-
}
181-
}
182-
return { result: null }
183-
},
184-
// deno-lint-ignore require-await
185-
async autoConfigure(effects, configInput) {
186-
effects.info('autoconfigure btc-rpc-proxy')
187-
for (const checker of proxyChecks) {
188-
const error = checker.currentError(configInput)
189-
if (error) {
190-
checker.fix(configInput)
191-
}
192-
}
193-
return { result: configInput }
194-
},
195-
},
196171
bitcoind: {
197172
// deno-lint-ignore require-await
198173
async check(effects, configInput) {

scripts/services/getConfig.ts

-23
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export const getConfig: T.ExpectedExports.getConfig = compat.getConfig({
1919
"name": "Select Bitcoin Node",
2020
"variant-names": {
2121
"bitcoind": "Bitcoin Core",
22-
"bitcoind-proxy": "Bitcoin Core (proxy)",
2322
"bitcoind-testnet": "Bitcoin Core (testnet4)",
2423
},
2524
"description": "The Bitcoin node type you would like to use for electrs",
@@ -48,28 +47,6 @@ export const getConfig: T.ExpectedExports.getConfig = compat.getConfig({
4847
"selector": "$.rpc.password",
4948
},
5049
},
51-
"bitcoind-proxy": {
52-
"username": {
53-
"type": "pointer",
54-
"name": "RPC Username",
55-
"description": "The username for the RPC user allocated to electrs",
56-
"subtype": "package",
57-
"package-id": "btc-rpc-proxy",
58-
"target": "config",
59-
"multi": false,
60-
"selector": "$.users[?(@.name == \"electrs\")].name",
61-
},
62-
"password": {
63-
"type": "pointer",
64-
"name": "RPC Password",
65-
"description": "The password for the RPC user allocated to electrs",
66-
"subtype": "package",
67-
"package-id": "btc-rpc-proxy",
68-
"target": "config",
69-
"multi": false,
70-
"selector": "$.users[?(@.name == \"electrs\")].password",
71-
},
72-
},
7350
"bitcoind-testnet": {
7451
"username": {
7552
"type": "pointer",

scripts/services/migrations.ts

+3-17
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,15 @@ export const migration: T.ExpectedExports.migration =
3737
"0.10.8.1": {
3838
up: compat.migrations.updateConfig(
3939
(config: any) => {
40-
switch (config.type) {
41-
case "internal-proxy":
42-
config.type = "bitcoind-proxy";
43-
break;
44-
default:
45-
config.type = "bitcoind";
46-
break;
47-
}
4840
config.bitcoind = {
49-
type: config.type,
41+
type: "bitcoind",
5042
username: config.user,
5143
password: config.password,
5244
};
5345

5446
delete config.user;
5547
delete config.password;
48+
delete config.type;
5649

5750
return config;
5851
},
@@ -61,14 +54,7 @@ export const migration: T.ExpectedExports.migration =
6154
),
6255
down: compat.migrations.updateConfig(
6356
(config: any) => {
64-
switch (config.bitcoind.type) {
65-
case "bitcoind-proxy":
66-
config.type = "internal-proxy";
67-
break;
68-
default:
69-
config.type = "internal";
70-
break;
71-
}
57+
config.type = config.bitcoind.type;
7258
config.user = config.bitcoind.username;
7359
config.password = config.bitcoind.password;
7460

0 commit comments

Comments
 (0)