Skip to content

Commit

Permalink
Update to v24 upstream, minor build edits, add Full RBF config option (
Browse files Browse the repository at this point in the history
…#107)

* Update to v24 upstream, minor build edits, add Full RBF config option

* Update migrations/gt_22_0_0_lt_23_0_0.sh

Co-authored-by: Chris Guida <chrisguida@users.noreply.github.com>

* Update scripts/services/getConfig.ts

Co-authored-by: Chris Guida <chrisguida@users.noreply.github.com>

* Cleanup

* cleanup

* strip all binaries

Co-authored-by: Chris Guida <chrisguida@users.noreply.github.com>
Co-authored-by: Chris Guida <chrisguida@gmail.com>
  • Loading branch information
3 people committed Dec 7, 2022
1 parent 31649d4 commit 5696eee
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 34 deletions.
12 changes: 2 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ FROM alpine:3.12 as bitcoin-core

COPY --from=berkeleydb /opt /opt

COPY ./SHA256SUMS.asc.patch SHA256SUMS.asc.patch

RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories
RUN apk --no-cache add autoconf
RUN apk --no-cache add automake
Expand All @@ -22,7 +20,6 @@ RUN apk --no-cache add libevent-dev
RUN apk --no-cache add libressl
RUN apk --no-cache add libtool
RUN apk --no-cache add linux-headers
# RUN apk --no-cache add sqlite-libs
RUN apk --no-cache add sqlite-dev
RUN apk --no-cache add zeromq-dev
RUN set -ex \
Expand Down Expand Up @@ -84,9 +81,9 @@ AEC1884398647C47413C1C3FB1179EB7347DC10D \
71A3B16735405025D447E8F274810B012346C9A6 \
287AE4CA1187C68C08B49CB2D11BD4F33F1DB499 \
F9A8737BF4FF5C89C903DF31DD78544CF91B1514 \
# C388F6961FB972A95678E327F62711DBDCA8AE56 \
4DAF18FE948E7A965B30F9457E296D555E7F63A7 \
28E72909F1717FE9607754F8A7BEB2621678D37D \
F19F5FF2B0589EC341220045BA03F4DBE0C63FB4 \
; do \
gpg --batch --keyserver hkps://keyserver.ubuntu.com --recv-keys "$key" || \
gpg --batch --keyserver hkps://pgp.mit.edu --recv-keys "$key" || \
Expand All @@ -103,16 +100,13 @@ ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION}
RUN wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS
RUN wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS.asc
RUN wget https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}.tar.gz
RUN patch -u SHA256SUMS.asc -i SHA256SUMS.asc.patch
RUN gpg --verify SHA256SUMS.asc
RUN grep " bitcoin-${BITCOIN_VERSION}.tar.gz\$" SHA256SUMS | sha256sum -c -
RUN tar -xzf *.tar.gz

WORKDIR /bitcoin-${BITCOIN_VERSION}

RUN sed -i '/AC_PREREQ/a\AR_FLAGS=cr' src/univalue/configure.ac
RUN sed -i '/AX_PROG_CC_FOR_BUILD/a\AR_FLAGS=cr' src/secp256k1/configure.ac
RUN sed -i s:sys/fcntl.h:fcntl.h: src/compat.h
RUN ./autogen.sh
RUN ./configure LDFLAGS=-L`ls -d /opt/db*`/lib/ CPPFLAGS=-I`ls -d /opt/db*`/include/ \
# If building on Mac make sure to increase Docker VM memory, or uncomment this line. See https://github.com/bitcoin/bitcoin/issues/6658 for more info.
Expand All @@ -128,9 +122,7 @@ RUN ./configure LDFLAGS=-L`ls -d /opt/db*`/lib/ CPPFLAGS=-I`ls -d /opt/db*`/incl
--with-daemon
RUN make -j$(($(nproc) - 1))
RUN make install
RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-cli
RUN strip ${BITCOIN_PREFIX}/bin/bitcoin-tx
RUN strip ${BITCOIN_PREFIX}/bin/bitcoind
RUN strip ${BITCOIN_PREFIX}/bin/*
RUN strip ${BITCOIN_PREFIX}/lib/libbitcoinconsensus.a
RUN strip ${BITCOIN_PREFIX}/lib/libbitcoinconsensus.so.0.0.0

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PKG_VERSION := $(shell yq e ".version" manifest.yaml)
PKG_ID := $(shell yq e ".id" manifest.yaml)
MANAGER_SRC := $(shell find ./manager -name '*.rs') manager/Cargo.toml manager/Cargo.lock
VERSION_CORE := "23.0"
VERSION_CORE := "24.0"

.DELETE_ON_ERROR:

Expand Down
16 changes: 0 additions & 16 deletions SHA256SUMS.asc.patch

This file was deleted.

6 changes: 6 additions & 0 deletions assets/compat/bitcoin.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ rpcthreads={{rpc.advanced.threads}}
rpcworkqueue={{rpc.advanced.workqueue}}

## MEMPOOL
{{#IF advanced.mempool.mempoolfullrbf
mempoolfullrbf=1
}}
{{#IF !advanced.mempool.mempoolfullrbf
mempoolfullrbf=0
}}
{{#IF advanced.mempool.persistmempool
persistmempool=1
}}
Expand Down
28 changes: 25 additions & 3 deletions manifest.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
id: bitcoind
title: "Bitcoin Core"
version: 23.0.1
version: 24.0.0
release-notes: |
* Add build for x86
* Update to latest upstream
* Add Full RBF Config option
license: mit
wrapper-repo: https://github.com/Start9Labs/bitcoind-wrapper
upstream-repo: https://github.com/bitcoin/bitcoin
Expand Down Expand Up @@ -182,7 +184,17 @@ migrations:
mounts:
main: /root/.bitcoin
inject: false
"=23.0.0":
"=23.0.0 <24.0.0":
type: docker
image: main
system: false
entrypoint: /usr/local/bin/migrations/eq_23_0_0_lt_24_0_0.sh
args: ["from"]
io-format: json
mounts:
main: /root/.bitcoin
inject: false
"=24.0.0":
type: docker
image: main
system: false
Expand Down Expand Up @@ -211,7 +223,17 @@ migrations:
mounts:
main: /root/.bitcoin
inject: false
"=23.0.0":
"=23.0.0 <24.0.0":
type: docker
image: main
system: false
entrypoint: /usr/local/bin/migrations/eq_23_0_0_lt_24_0_0.sh
args: ["to"]
io-format: json
mounts:
main: /root/.bitcoin
inject: false
"=24.0.0":
type: docker
image: main
system: false
Expand Down
20 changes: 20 additions & 0 deletions migrations/eq_23_0_0_lt_24_0_0.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

set -ea

if [ $1 = "from" ]; then
yq -i '.advanced.peers.addnode |= map(select(.hostname != ~ or . == "*"))' /root/.bitcoin/start9/config.yaml
yq -i '.advanced.peers.addnode.[] |= {"hostname":., "port":~}' /root/.bitcoin/start9/config.yaml
yq -i '(.advanced.mempool.mempoolfullrbf) = false' /root/.bitcoin/start9/config.yaml
echo '{"configured": false }'
exit 0
elif [ $1 = "to" ]; then
yq -i '.advanced.peers.addnode |= map_values(.hostname)' /root/.bitcoin/start9/config.yaml
yq -i 'del(.advanced.bloomfilters)' /root/.bitcoin/start9/config.yaml
yq -i 'del(.advanced.mempool.mempoolfullrbf)' /root/.bitcoin/start9/config.yaml
echo '{"configured": false }'
exit 0
else
echo "FATAL: Invalid argument: {from, to}. Migration failed." >&2
exit 1
fi
4 changes: 3 additions & 1 deletion migrations/gt_22_0_0_lt_23_0_0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@ set -ea
if [ $1 = "from" ]; then
yq -i '.advanced.peers.addnode |= map(select(.hostname != ~ or . == "*"))' /root/.bitcoin/start9/config.yaml
yq -i '.advanced.peers.addnode.[] |= {"hostname":., "port":~}' /root/.bitcoin/start9/config.yaml
yq -i '(.advanced.mempool.mempoolfullrbf) = false' /root/.bitcoin/start9/config.yaml
echo '{"configured": false }'
exit 0
elif [ $1 = "to" ]; then
yq -i '.advanced.peers.addnode |= map_values(.hostname)' /root/.bitcoin/start9/config.yaml
yq -i 'del(.advanced.bloomfilters)' /root/.bitcoin/start9/config.yaml
yq -i 'del(.advanced.mempool.mempoolfullrbf)' /root/.bitcoin/start9/config.yaml
echo '{"configured": false }'
exit 0
else
echo "FATAL: Invalid argument: {from, to}. Migration failed." >&2
exit 1
fi
``

4 changes: 2 additions & 2 deletions migrations/lt_22_0_0.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ set -ea
if [ $1 = "from" ]; then
yq -i '.advanced.peers.addnode |= map(select(.hostname != ~ or . == "*"))' /root/.bitcoin/start9/config.yaml
yq -i '.advanced.peers.addnode.[] |= {"hostname":., "port":~}' /root/.bitcoin/start9/config.yaml
yq -i '(.advanced.blockfilters.blockfilterindex, .advanced.blockfilters.peerblockfilters, .advanced.bloomfilters.peerbloomfilters) = false' /root/.bitcoin/start9/config.yaml
yq -i '(.advanced.blockfilters.blockfilterindex, .advanced.blockfilters.peerblockfilters, .advanced.bloomfilters.peerbloomfilters, .advanced.mempool.mempoolfullrbf) = false' /root/.bitcoin/start9/config.yaml
echo '{"configured": true }'
exit 0
elif [ $1 = "to" ]; then
yq -i '.advanced.peers.addnode |= map_values(.hostname)' /root/.bitcoin/start9/config.yaml
yq -i 'del(.advanced.blockfilters)' /root/.bitcoin/start9/config.yaml
yq -i 'del(.advanced.bloomfilters)' /root/.bitcoin/start9/config.yaml
yq -i 'del(.advanced.mempool.mempoolfullrbf)' /root/.bitcoin/start9/config.yaml
echo '{"configured": false }'
exit 0
else
echo "FATAL: Invalid argument: {from, to}. Migration failed." >&2
exit 1
fi
``
9 changes: 8 additions & 1 deletion scripts/services/getConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export const getConfig: T.ExpectedExports.getConfig = compat.getConfig({
"Set the depth of the work queue to service RPC calls. Determines how long the backlog of RPC requests can get before it just rejects new ones.",
"type": "number",
"nullable": false,
"default": 64,
"default": 128,
"range": "[8,256]",
"integral": true,
"units": "requests",
Expand Down Expand Up @@ -178,6 +178,13 @@ export const getConfig: T.ExpectedExports.getConfig = compat.getConfig({
"name": "Mempool",
"description": "Mempool Settings",
"spec": {
"mempoolfullrbf": {
"name": "Enable Full RBF",
"description":
"Policy for your node to use for relaying and mining unconfirmed transactions. For details, see https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-24.0.md#notice-of-new-option-for-transaction-replacement-policies",
"type": "boolean",
"default": false,
},
"persistmempool": {
"type": "boolean",
"name": "Persist Mempool",
Expand Down

0 comments on commit 5696eee

Please sign in to comment.