Skip to content

Commit

Permalink
add prioritise transaction action (#8)
Browse files Browse the repository at this point in the history
* add prioritise transaction action

* actions fully works

* make them strings for now

* ok it's a number now

* allow larger range
  • Loading branch information
BitcoinMechanic authored Oct 13, 2024
1 parent b4099bf commit 18d1303
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fast
RUN apk --no-cache add \
bash \
curl \
jq \
libevent \
libzmq \
sqlite-dev \
Expand All @@ -82,6 +83,7 @@ COPY --from=bitcoin-core /opt /opt
COPY ./manager/target/${ARCH}-unknown-linux-musl/release/bitcoind-manager \
./docker_entrypoint.sh \
./actions/reindex.sh \
./actions/prioritise-transaction.sh \
./check-rpc.sh \
./check-synced.sh \
/usr/local/bin/
Expand Down
23 changes: 23 additions & 0 deletions actions/prioritise-transaction.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

set -e

cat > input.json
TXID=$(jq -r '.["txid"]' input.json)
PRIORITY_DELTA=$(jq -r '.["priority-delta"]' input.json)
if [ $PRIORITY_DELTA = "null" ]; then
PRIORITY_DELTA="0"
fi
FEE_DELTA=$(jq -r '.["fee-delta"]' input.json)
if [ $FEE_DELTA = "null" ]; then
FEE_DELTA="0"
fi
rm input.json
result=" {
\"version\": \"0\",
\"message\": \"Transaction prioritised with priority delta $PRIORITY_DELTA and fee delta $FEE_DELTA\",
\"value\": null,
\"copyable\": false,
\"qr\": false
}"
>&2 bitcoin-cli prioritisetransaction $TXID $PRIORITY_DELTA $FEE_DELTA && echo $result
40 changes: 40 additions & 0 deletions manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,46 @@ actions:
- stopped
implementation:
type: script
prioritise-transaction:
name: "Prioritise Transaction"
description: "Prioritise or de-prioritise a transaction. Your Bitcoin node will treat it as though it is paying a higher or lower fee rate than it is and construct templates accordingly."
allowed-statuses:
- running
implementation:
type: docker
image: main
system: false
entrypoint: prioritise-transaction.sh
args: []
io-format: json
mounts:
main: /root/.bitcoin
inject: true
input-spec:
txid:
type: string
name: Transaction ID
description: "The ID of the transaction you wish to prioritise."
placeholder: ""
nullable: false
priority-delta:
type: number
name: Priority Delta
description: "The priority to add or subtract."
nullable: true
integral: true
range: "[-1000000,1000000]"
default: 0
nullable: true
fee-delta:
type: number
name: Fee Delta
description: "The fee value (in satoshis) to add (or subtract, if negative)."
nullable: true
integral: true
range: "[-1000000,1000000]"
default: 0
nullable: true
migrations:
from:
"*":
Expand Down

0 comments on commit 18d1303

Please sign in to comment.