Skip to content

Commit

Permalink
Feature/lite (#120)
Browse files Browse the repository at this point in the history
* support for the lite

* rework config and delete action (#119)

* rework config and delete action

* migrations

---------

Co-authored-by: Aiden McClelland <[email protected]>

* update release notes

* address comments

* update version

* fix peers queries

* fixes from testing

---------

Co-authored-by: Matt Hill <[email protected]>
  • Loading branch information
dr-bonez and MattDHill authored Jun 21, 2023
1 parent 1add04c commit 8e33212
Show file tree
Hide file tree
Showing 16 changed files with 1,495 additions and 840 deletions.
47 changes: 8 additions & 39 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,40 +22,13 @@ RUN apk --no-cache add libtool
RUN apk --no-cache add linux-headers
RUN apk --no-cache add sqlite-dev
RUN apk --no-cache add zeromq-dev
RUN set -ex \
&& for key in \
152812300785C96444D3334D17565732E08E5E41 \
0AD83877C1F0CD1EE9BD660AD7CC770B81FD22A8 \
590B7292695AFFA5B672CBB2E13FC145CD3F4304 \
CFB16E21C950F67FA95E558F2EEB9F5CC09526C1 \
F4FC70F07310028424EFC20A8E4256593F177720 \
D1DBF2C4B96F2DEBF4C16654410108112E7EA81F \
287AE4CA1187C68C08B49CB2D11BD4F33F1DB499 \
9DEAE0DC7063249FB05474681E4AED62986CD25D \
3EB0DEE6004A13BE5A0CC758BF2978B068054311 \
ED9BDF7AD6A55E232E84524257FF9BDBCC301009 \
28E72909F1717FE9607754F8A7BEB2621678D37D \
79D00BAC68B56D422F945A8F8E3A8F3247DBCBBF \
; do \
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$key" || \
gpg --batch --keyserver keyserver.pgp.com --recv-keys "$key" || \
gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys "$key" || \
gpg --batch --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys "$key" || \
gpg --batch --keyserver keys.openpgp.org --recv-keys "$key" ; \
done

ARG BITCOIN_VERSION
RUN test -n "$BITCOIN_VERSION"
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 gpg --verify SHA256SUMS.asc SHA256SUMS
RUN grep " bitcoin-${BITCOIN_VERSION}.tar.gz\$" SHA256SUMS | sha256sum -c -
RUN tar -xzf *.tar.gz

WORKDIR /bitcoin-${BITCOIN_VERSION}

ADD ./bitcoin /bitcoin


ENV BITCOIN_PREFIX=/opt/bitcoin

WORKDIR /bitcoin

RUN sed -i '/AX_PROG_CC_FOR_BUILD/a\AR_FLAGS=cr' src/secp256k1/configure.ac
RUN ./autogen.sh
Expand Down Expand Up @@ -102,9 +75,7 @@ RUN rm -rf /var/cache/apk/*
ARG ARCH

ENV BITCOIN_DATA=/root/.bitcoin
ARG BITCOIN_VERSION
RUN test -n "$BITCOIN_VERSION"
ENV BITCOIN_PREFIX=/opt/bitcoin-${BITCOIN_VERSION}
ENV BITCOIN_PREFIX=/opt/bitcoin
ENV PATH=${BITCOIN_PREFIX}/bin:$PATH

COPY --from=bitcoin-core /opt /opt
Expand All @@ -118,8 +89,6 @@ ADD ./check-rpc.sh /usr/local/bin/check-rpc.sh
RUN chmod a+x /usr/local/bin/check-rpc.sh
ADD ./check-synced.sh /usr/local/bin/check-synced.sh
RUN chmod a+x /usr/local/bin/check-synced.sh
ADD ./migrations /usr/local/bin/migrations
RUN chmod a+x /usr/local/bin/migrations/*

EXPOSE 8332 8333

Expand Down
20 changes: 6 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
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 := "24.0.1"
VERSION_CORE := $(shell (cd bitcoin && git describe) | sed 's/^v//')

.DELETE_ON_ERROR:

all: submodule-update verify
all: verify

clean:
rm -f $(PKG_ID).s9pk
Expand Down Expand Up @@ -44,18 +44,18 @@ else
embassy-cli package install $(PKG_ID).s9pk
endif

docker-images/aarch64.tar: Dockerfile docker_entrypoint.sh manager/target/aarch64-unknown-linux-musl/release/bitcoind-manager manifest.yaml check-rpc.sh check-synced.sh migrations/* actions/*
docker-images/aarch64.tar: Dockerfile docker_entrypoint.sh manager/target/aarch64-unknown-linux-musl/release/bitcoind-manager manifest.yaml check-rpc.sh check-synced.sh actions/*
ifeq ($(ARCH),x86_64)
else
mkdir -p docker-images
docker buildx build --tag start9/$(PKG_ID)/main:$(PKG_VERSION) --build-arg BITCOIN_VERSION=$(VERSION_CORE) --build-arg ARCH=aarch64 --build-arg PLATFORM=arm64 --platform=linux/arm64 -o type=docker,dest=docker-images/aarch64.tar .
docker buildx build --tag start9/$(PKG_ID)/main:$(PKG_VERSION) --build-arg ARCH=aarch64 --build-arg PLATFORM=arm64 --platform=linux/arm64 -o type=docker,dest=docker-images/aarch64.tar .
endif

docker-images/x86_64.tar: Dockerfile docker_entrypoint.sh manager/target/x86_64-unknown-linux-musl/release/bitcoind-manager manifest.yaml check-rpc.sh check-synced.sh migrations/* actions/*
docker-images/x86_64.tar: Dockerfile docker_entrypoint.sh manager/target/x86_64-unknown-linux-musl/release/bitcoind-manager manifest.yaml check-rpc.sh check-synced.sh actions/*
ifeq ($(ARCH),aarch64)
else
mkdir -p docker-images
docker buildx build --tag start9/$(PKG_ID)/main:$(PKG_VERSION) --build-arg BITCOIN_VERSION=$(VERSION_CORE) --build-arg ARCH=x86_64 --build-arg PLATFORM=amd64 --platform=linux/amd64 -o type=docker,dest=docker-images/x86_64.tar .
docker buildx build --tag start9/$(PKG_ID)/main:$(PKG_VERSION) --build-arg ARCH=x86_64 --build-arg PLATFORM=amd64 --platform=linux/amd64 -o type=docker,dest=docker-images/x86_64.tar .
endif

manager/target/aarch64-unknown-linux-musl/release/bitcoind-manager: $(MANAGER_SRC)
Expand All @@ -66,11 +66,3 @@ manager/target/x86_64-unknown-linux-musl/release/bitcoind-manager: $(MANAGER_SRC

scripts/embassy.js: scripts/**/*.ts
deno bundle scripts/embassy.ts scripts/embassy.js

submodule-update:
@if [ -z "$(shell git submodule status | egrep -v '^ '|awk '{print $$2}')" ]; then \
echo "Submodules are up to date."; \
else \
echo "\nUpdating submodules...\n"; \
git submodule update --init --progress; \
fi
69 changes: 32 additions & 37 deletions assets/compat/bitcoin.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -4,71 +4,71 @@

## RPC
{{#IF rpc.enable
{{#IF advanced.pruning.mode = "automatic"
rpcbind=127.0.0.1:18332
rpcallowip=127.0.0.1/32
}}
{{#IF advanced.pruning.mode != "automatic"
rpcbind=0.0.0.0:8332
rpcallowip=0.0.0.0/0
}}
}}
rpcuser={{rpc.username}}
rpcpassword={{rpc.password}}
{{#FOREACH rpc.advanced.auth
rpcauth={{rpc.advanced.auth}}
}}
{{#IF rpc.advanced.serialversion = "segwit"
rpcserialversion=1
{{#FOREACH rpc.auth
rpcauth={{rpc.auth}}
}}
{{#IF rpc.advanced.serialversion = "non-segwit"
rpcserialversion=0
}}
rpcservertimeout={{rpc.advanced.servertimeout}}
rpcthreads={{rpc.advanced.threads}}
rpcworkqueue={{rpc.advanced.workqueue}}
rpcservertimeout={{rpc.servertimeout}}
rpcthreads={{rpc.threads}}
rpcworkqueue={{rpc.workqueue}}

## MEMPOOL
{{#IF advanced.mempool.mempoolfullrbf
{{#IF mempool.mempoolfullrbf
mempoolfullrbf=1
}}
{{#IF !advanced.mempool.mempoolfullrbf
{{#IF !mempool.mempoolfullrbf
mempoolfullrbf=0
}}
{{#IF advanced.mempool.persistmempool
{{#IF mempool.persistmempool
persistmempool=1
}}
{{#IF !advanced.mempool.persistmempool
{{#IF !mempool.persistmempool
persistmempool=0
}}
maxmempool={{advanced.mempool.maxmempool}}
mempoolexpiry={{advanced.mempool.mempoolexpiry}}
maxmempool={{mempool.maxmempool}}
mempoolexpiry={{mempool.mempoolexpiry}}

## PEERS
{{#IF advanced.peers.listen
{{#IF peers.listen
listen=1
bind=0.0.0.0:8333
}}
{{#IF !advanced.peers.listen
{{#IF !peers.listen
listen=0
}}

{{#IF advanced.peers.onlyconnect
{{#FOREACH advanced.peers.addnode
{{#IF advanced.peers.addnode.port
connect={{advanced.peers.addnode.hostname}}:{{advanced.peers.addnode.port}}
{{#IF peers.onlyconnect
{{#FOREACH peers.addnode
{{#IF peers.addnode.port
connect={{peers.addnode.hostname}}:{{peers.addnode.port}}
}}
{{#IF !advanced.peers.addnode.port
connect={{advanced.peers.addnode.hostname}}
{{#IF !peers.addnode.port
connect={{peers.addnode.hostname}}
}}
}}
}}

{{#IF !advanced.peers.onlyconnect
{{#FOREACH advanced.peers.addnode
{{#IF advanced.peers.addnode.port
addnode={{advanced.peers.addnode.hostname}}:{{advanced.peers.addnode.port}}
{{#IF !peers.onlyconnect
{{#FOREACH peers.addnode
{{#IF peers.addnode.port
addnode={{peers.addnode.hostname}}:{{peers.addnode.port}}
}}
{{#IF !advanced.peers.addnode.port
addnode={{advanced.peers.addnode.hostname}}
{{#IF !peers.addnode.port
addnode={{peers.addnode.hostname}}
}}
}}
}}
{{#IF advanced.peers.onlyonion
{{#IF peers.onlyonion
onlynet=onion
}}

Expand All @@ -77,9 +77,6 @@ onlynet=onion
whitelist=172.18.0.0/16

## PRUNING
{{#IF advanced.pruning.mode = "manual"
prune=1
}}
{{#IF advanced.pruning.mode = "automatic"
prune={{advanced.pruning.size}}
}}
Expand All @@ -105,13 +102,11 @@ avoidpartialspends=0
discardfee={{wallet.discardfee}}

## ZERO MQ
{{#IF zmq-enabled
zmqpubrawblock=tcp://0.0.0.0:28332
zmqpubhashblock=tcp://0.0.0.0:28332
zmqpubrawtx=tcp://0.0.0.0:28333
zmqpubhashtx=tcp://0.0.0.0:28333
zmqpubsequence=tcp://0.0.0.0:28333
}}

## TXINDEX
{{#IF txindex
Expand Down
2 changes: 1 addition & 1 deletion bitcoin
Submodule bitcoin updated 1390 files
Loading

0 comments on commit 8e33212

Please sign in to comment.