Skip to content

Commit

Permalink
Merge pull request #5 from remcoros/enable-zmq
Browse files Browse the repository at this point in the history
enable ZeroMQ
  • Loading branch information
remcoros authored Oct 4, 2024
2 parents db50f97 + 890071f commit a892f78
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 5 deletions.
19 changes: 16 additions & 3 deletions docker_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,41 @@ export STRATUM_PORT=3333
export DEV_FEE_ADDRESS=
export API_SECURE=false

ZMQ_ENABLED=$(yq e '.zmq-enabled' /public-pool-data/start9/config.yaml)
case "$(yq e '.bitcoind.type' /public-pool-data/start9/config.yaml)" in
"mainnet")
mkdir -p /public-pool-data/mainnet
ln -s /public-pool-data/mainnet /public-pool/DB

export NETWORK=mainnet
#export BITCOIN_ZMQ_HOST=tcp://bitcoind.embassy:28333
export BITCOIN_RPC_URL=http://bitcoind.embassy
export BITCOIN_RPC_PORT=8332

echo "Configured Public Pool for mainnet: $BITCOIN_RPC_URL:$BITCOIN_RPC_PORT"

if [ "$ZMQ_ENABLED" = "true" ]; then
export BITCOIN_ZMQ_HOST=tcp://bitcoind.embassy:28332
echo "ZMQ Enabled"
fi
;;
"testnet")
mkdir -p /public-pool-data/testnet
ln -s /public-pool-data/testnet /public-pool/DB

export NETWORK=testnet
#export BITCOIN_ZMQ_HOST=tcp://bitcoind-testnet.embassy:28333
export BITCOIN_RPC_URL=http://bitcoind-testnet.embassy
export BITCOIN_RPC_PORT=48332

echo "Configured Public Pool for testnet4: $BITCOIN_RPC_URL:$BITCOIN_RPC_PORT"

if [ "$ZMQ_ENABLED" = "true" ]; then
export BITCOIN_ZMQ_HOST=tcp://bitcoind-testnet.embassy:28332
echo "ZMQ Enabled"
fi
;;
*)
echo "Unknown Bitcoin Core node type. Exiting."
exit
exit 1
;;
esac

Expand Down
2 changes: 1 addition & 1 deletion manifest.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
id: public-pool
title: "Public Pool"
version: 0.2.1
version: 0.2.2
release-notes: |
* Fix: add retry logic to 'getblocktemplate' in case Bitcoin Core fails to respond to RPC requests.
license: GPL
Expand Down
6 changes: 6 additions & 0 deletions scripts/procedures/getConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ export const getConfig: T.ExpectedExports.getConfig = compat.getConfig({
},
},
},
"zmq-enabled": {
"type": "boolean",
"name": "Use ZeroMQ (recommended)",
"description": "Uses ZeroMQ for new block notifications, this is generally faster than polling over RPC",
"default": true,
},
"pool-identifier": {
"type": "string",
"name": "Pool Identifier",
Expand Down
21 changes: 20 additions & 1 deletion scripts/procedures/migrations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,23 @@
import { compat, types as T } from "../deps.ts";

export const migration: T.ExpectedExports.migration = compat.migrations
.fromMapping({}, "0.2.1" );
.fromMapping({
"0.2.2": {
up: compat.migrations.updateConfig(
(config: any) => {
config["zmq-enabled"] = true;
return config;
},
true,
{ version: "0.2.2", type: "up" },
),
down: compat.migrations.updateConfig(
(config: any) => {
delete config["zmq-enabled"];
return config;
},
true,
{ version: "0.2.2", type: "down" },
),
},
}, "0.2.2");

0 comments on commit a892f78

Please sign in to comment.