diff --git a/Dockerfile b/Dockerfile index 9dfe582..c942e2b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -88,6 +88,7 @@ COPY ./manager/target/${ARCH}-unknown-linux-musl/release/bitcoind-manager \ ./actions/sendcoin.sh \ ./actions/sendall.sh \ ./actions/signmessage.sh \ + ./actions/assumeutxo.sh \ ./actions/reindex_chainstate.sh \ ./actions/prioritise-transaction.sh \ ./check-rpc.sh \ diff --git a/actions/assumeutxo.sh b/actions/assumeutxo.sh new file mode 100644 index 0000000..bfea1e2 --- /dev/null +++ b/actions/assumeutxo.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +set -e + +cat > input.json + +URL=$(jq -r '.["location"]' input.json) + +rm input.json + +download_and_load() { + mkdir -p /tmp/snap + rm -rf /tmp/snap/snapshot + wget -q $URL -O /tmp/snap/snapshot + bitcoin-cli loadtxoutset /tmp/snap/snapshot +} + +download_and_load & + +result=" { + \"version\": \"0\", + \"message\": \"Consult the logs to see if the snapshot the progression. Do not restart knots until the snapshot is loaded. If the snapshot is invalid nothing will happen.\", + \"value\": null, + \"copyable\": false, + \"qr\": false + }" + +echo $result diff --git a/manifest.yaml b/manifest.yaml index 52028b6..fbbeba3 100644 --- a/manifest.yaml +++ b/manifest.yaml @@ -351,7 +351,28 @@ actions: description: "The message to sign." placeholder: "" nullable: false - + assumeutxo: + name: "Assume UTXO" + description: "Use an UTXO snapshot for instant use of your node." + allowed-statuses: + - running + implementation: + type: docker + image: main + system: false + entrypoint: assumeutxo.sh + args: [] + io-format: json + mounts: + main: /root/.bitcoin + inject: true + input-spec: + location: + type: string + name: "Snapshot URL" + description: "The URL where we download the snapshot" + placeholder: "" + nullable: false migrations: from: "*":