mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-09 11:27:28 -03:00
Compare commits
13 commits
dd0390b994
...
683c0002e6
Author | SHA1 | Date | |
---|---|---|---|
|
683c0002e6 | ||
|
66aa6a47bd | ||
|
7c123c08dd | ||
|
ba67aa681e | ||
|
51237e4418 | ||
|
cc533421e4 | ||
|
edc18462d8 | ||
|
480e8bb3b5 | ||
|
14efedc992 | ||
|
764f9d176d | ||
|
708fc182df | ||
|
69ffb78d70 | ||
|
912377ac49 |
10 changed files with 179 additions and 80 deletions
|
@ -137,7 +137,7 @@ fi
|
|||
|
||||
|
||||
################
|
||||
# Unsigned tarballs SHOULD exist
|
||||
# Codesigning tarballs SHOULD exist
|
||||
################
|
||||
|
||||
# Usage: outdir_for_host HOST SUFFIX
|
||||
|
@ -149,13 +149,13 @@ outdir_for_host() {
|
|||
}
|
||||
|
||||
|
||||
unsigned_tarball_for_host() {
|
||||
codesigning_tarball_for_host() {
|
||||
case "$1" in
|
||||
*mingw*)
|
||||
echo "$(outdir_for_host "$1")/${DISTNAME}-win64-unsigned.tar.gz"
|
||||
echo "$(outdir_for_host "$1")/${DISTNAME}-win64-codesigning.tar.gz"
|
||||
;;
|
||||
*darwin*)
|
||||
echo "$(outdir_for_host "$1")/${DISTNAME}-${1}-unsigned.tar.gz"
|
||||
echo "$(outdir_for_host "$1")/${DISTNAME}-${1}-codesigning.tar.gz"
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
|
@ -164,22 +164,22 @@ unsigned_tarball_for_host() {
|
|||
}
|
||||
|
||||
# Accumulate a list of build directories that already exist...
|
||||
hosts_unsigned_tarball_missing=""
|
||||
hosts_codesigning_tarball_missing=""
|
||||
for host in $HOSTS; do
|
||||
if [ ! -e "$(unsigned_tarball_for_host "$host")" ]; then
|
||||
hosts_unsigned_tarball_missing+=" ${host}"
|
||||
if [ ! -e "$(codesigning_tarball_for_host "$host")" ]; then
|
||||
hosts_codesigning_tarball_missing+=" ${host}"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$hosts_unsigned_tarball_missing" ]; then
|
||||
if [ -n "$hosts_codesigning_tarball_missing" ]; then
|
||||
# ...so that we can print them out nicely in an error message
|
||||
cat << EOF
|
||||
ERR: Unsigned tarballs do not exist
|
||||
ERR: Codesigning tarballs do not exist
|
||||
...
|
||||
|
||||
EOF
|
||||
for host in $hosts_unsigned_tarball_missing; do
|
||||
echo " ${host} '$(unsigned_tarball_for_host "$host")'"
|
||||
for host in $hosts_codesigning_tarball_missing; do
|
||||
echo " ${host} '$(codesigning_tarball_for_host "$host")'"
|
||||
done
|
||||
exit 1
|
||||
fi
|
||||
|
@ -371,7 +371,7 @@ EOF
|
|||
OUTDIR="$(OUTDIR_BASE=/outdir-base && outdir_for_host "$HOST" codesigned)" \
|
||||
DIST_ARCHIVE_BASE=/outdir-base/dist-archive \
|
||||
DETACHED_SIGS_REPO=/detached-sigs \
|
||||
UNSIGNED_TARBALL="$(OUTDIR_BASE=/outdir-base && unsigned_tarball_for_host "$HOST")" \
|
||||
CODESIGNING_TARBALL="$(OUTDIR_BASE=/outdir-base && codesigning_tarball_for_host "$HOST")" \
|
||||
bash -c "cd /bitcoin && bash contrib/guix/libexec/codesign.sh"
|
||||
)
|
||||
|
||||
|
|
|
@ -283,24 +283,6 @@ mkdir -p "$DISTSRC"
|
|||
;;
|
||||
esac
|
||||
|
||||
case "$HOST" in
|
||||
*darwin*)
|
||||
cmake --build build --target deploy ${V:+--verbose}
|
||||
mv build/dist/Bitcoin-Core.zip "${OUTDIR}/${DISTNAME}-${HOST}-unsigned.zip"
|
||||
mkdir -p "unsigned-app-${HOST}"
|
||||
cp --target-directory="unsigned-app-${HOST}" \
|
||||
contrib/macdeploy/detached-sig-create.sh
|
||||
mv --target-directory="unsigned-app-${HOST}" build/dist
|
||||
(
|
||||
cd "unsigned-app-${HOST}"
|
||||
find . -print0 \
|
||||
| sort --zero-terminated \
|
||||
| tar --create --no-recursion --mode='u+rw,go+r-w,a+X' --null --files-from=- \
|
||||
| gzip -9n > "${OUTDIR}/${DISTNAME}-${HOST}-unsigned.tar.gz" \
|
||||
|| ( rm -f "${OUTDIR}/${DISTNAME}-${HOST}-unsigned.tar.gz" && exit 1 )
|
||||
)
|
||||
;;
|
||||
esac
|
||||
(
|
||||
cd installed
|
||||
|
||||
|
@ -329,7 +311,7 @@ mkdir -p "$DISTSRC"
|
|||
|
||||
cp -r "${DISTSRC}/share/rpcauth" "${DISTNAME}/share/"
|
||||
|
||||
# Finally, deterministically produce {non-,}debug binary tarballs ready
|
||||
# Deterministically produce {non-,}debug binary tarballs ready
|
||||
# for release
|
||||
case "$HOST" in
|
||||
*mingw*)
|
||||
|
@ -337,8 +319,8 @@ mkdir -p "$DISTSRC"
|
|||
| xargs -0r touch --no-dereference --date="@${SOURCE_DATE_EPOCH}"
|
||||
find "${DISTNAME}" -not -name "*.dbg" \
|
||||
| sort \
|
||||
| zip -X@ "${OUTDIR}/${DISTNAME}-${HOST//x86_64-w64-mingw32/win64}.zip" \
|
||||
|| ( rm -f "${OUTDIR}/${DISTNAME}-${HOST//x86_64-w64-mingw32/win64}.zip" && exit 1 )
|
||||
| zip -X@ "${OUTDIR}/${DISTNAME}-${HOST//x86_64-w64-mingw32/win64}-unsigned.zip" \
|
||||
|| ( rm -f "${OUTDIR}/${DISTNAME}-${HOST//x86_64-w64-mingw32/win64}-unsigned.zip" && exit 1 )
|
||||
find "${DISTNAME}" -name "*.dbg" -print0 \
|
||||
| xargs -0r touch --no-dereference --date="@${SOURCE_DATE_EPOCH}"
|
||||
find "${DISTNAME}" -name "*.dbg" \
|
||||
|
@ -362,12 +344,13 @@ mkdir -p "$DISTSRC"
|
|||
find "${DISTNAME}" -print0 \
|
||||
| sort --zero-terminated \
|
||||
| tar --create --no-recursion --mode='u+rw,go+r-w,a+X' --null --files-from=- \
|
||||
| gzip -9n > "${OUTDIR}/${DISTNAME}-${HOST}.tar.gz" \
|
||||
|| ( rm -f "${OUTDIR}/${DISTNAME}-${HOST}.tar.gz" && exit 1 )
|
||||
| gzip -9n > "${OUTDIR}/${DISTNAME}-${HOST}-unsigned.tar.gz" \
|
||||
|| ( rm -f "${OUTDIR}/${DISTNAME}-${HOST}-unsigned.tar.gz" && exit 1 )
|
||||
;;
|
||||
esac
|
||||
) # $DISTSRC/installed
|
||||
|
||||
# Finally make tarballs for codesigning
|
||||
case "$HOST" in
|
||||
*mingw*)
|
||||
cp -rf --target-directory=. contrib/windeploy
|
||||
|
@ -375,11 +358,31 @@ mkdir -p "$DISTSRC"
|
|||
cd ./windeploy
|
||||
mkdir -p unsigned
|
||||
cp --target-directory=unsigned/ "${OUTDIR}/${DISTNAME}-win64-setup-unsigned.exe"
|
||||
cp -r --target-directory=unsigned/ "${INSTALLPATH}"
|
||||
find unsigned/ -name "*.dbg" -print0 \
|
||||
| xargs -0r rm
|
||||
find . -print0 \
|
||||
| sort --zero-terminated \
|
||||
| tar --create --no-recursion --mode='u+rw,go+r-w,a+X' --null --files-from=- \
|
||||
| gzip -9n > "${OUTDIR}/${DISTNAME}-win64-unsigned.tar.gz" \
|
||||
|| ( rm -f "${OUTDIR}/${DISTNAME}-win64-unsigned.tar.gz" && exit 1 )
|
||||
| gzip -9n > "${OUTDIR}/${DISTNAME}-win64-codesigning.tar.gz" \
|
||||
|| ( rm -f "${OUTDIR}/${DISTNAME}-win64-codesigning.tar.gz" && exit 1 )
|
||||
)
|
||||
;;
|
||||
*darwin*)
|
||||
cmake --build build --target deploy ${V:+--verbose}
|
||||
mv build/dist/Bitcoin-Core.zip "${OUTDIR}/${DISTNAME}-${HOST}-unsigned.zip"
|
||||
mkdir -p "unsigned-app-${HOST}"
|
||||
cp --target-directory="unsigned-app-${HOST}" \
|
||||
contrib/macdeploy/detached-sig-create.sh
|
||||
mv --target-directory="unsigned-app-${HOST}" build/dist
|
||||
cp -r --target-directory="unsigned-app-${HOST}" "${INSTALLPATH}"
|
||||
(
|
||||
cd "unsigned-app-${HOST}"
|
||||
find . -print0 \
|
||||
| sort --zero-terminated \
|
||||
| tar --create --no-recursion --mode='u+rw,go+r-w,a+X' --null --files-from=- \
|
||||
| gzip -9n > "${OUTDIR}/${DISTNAME}-${HOST}-codesigning.tar.gz" \
|
||||
|| ( rm -f "${OUTDIR}/${DISTNAME}-${HOST}-codesigning.tar.gz" && exit 1 )
|
||||
)
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -27,7 +27,7 @@ fi
|
|||
# Check that required environment variables are set
|
||||
cat << EOF
|
||||
Required environment variables as seen inside the container:
|
||||
UNSIGNED_TARBALL: ${UNSIGNED_TARBALL:?not set}
|
||||
CODESIGNING_TARBALL: ${CODESIGNING_TARBALL:?not set}
|
||||
DETACHED_SIGS_REPO: ${DETACHED_SIGS_REPO:?not set}
|
||||
DIST_ARCHIVE_BASE: ${DIST_ARCHIVE_BASE:?not set}
|
||||
DISTNAME: ${DISTNAME:?not set}
|
||||
|
@ -63,27 +63,54 @@ mkdir -p "$DISTSRC"
|
|||
(
|
||||
cd "$DISTSRC"
|
||||
|
||||
tar -xf "$UNSIGNED_TARBALL"
|
||||
tar -xf "$CODESIGNING_TARBALL"
|
||||
|
||||
mkdir -p codesignatures
|
||||
tar -C codesignatures -xf "$CODESIGNATURE_GIT_ARCHIVE"
|
||||
|
||||
case "$HOST" in
|
||||
*mingw*)
|
||||
find "$PWD" -name "*-unsigned.exe" | while read -r infile; do
|
||||
infile_base="$(basename "$infile")"
|
||||
|
||||
# Codesigned *-unsigned.exe and output to OUTDIR
|
||||
# Apply detached codesignatures
|
||||
WORKDIR=".tmp"
|
||||
mkdir -p ${WORKDIR}
|
||||
cp -r --target-directory="${WORKDIR}" "unsigned/${DISTNAME}"
|
||||
find "${WORKDIR}/${DISTNAME}" -name "*.exe" -type f -exec rm {} \;
|
||||
find unsigned/ -name "*.exe" -type f | while read -r bin
|
||||
do
|
||||
bin_base="$(realpath --relative-to=unsigned/ "${bin}")"
|
||||
mkdir -p "${WORKDIR}/$(dirname "${bin_base}")"
|
||||
osslsigncode attach-signature \
|
||||
-in "$infile" \
|
||||
-out "${OUTDIR}/${infile_base/-unsigned}" \
|
||||
-in "${bin}" \
|
||||
-out "${WORKDIR}/${bin_base/-unsigned}" \
|
||||
-CAfile "$GUIX_ENVIRONMENT/etc/ssl/certs/ca-certificates.crt" \
|
||||
-sigin codesignatures/win/"$infile_base".pem
|
||||
-sigin codesignatures/win/"${bin_base}".pem
|
||||
done
|
||||
|
||||
# Move installer to outdir
|
||||
cd "${WORKDIR}"
|
||||
find . -name "*setup.exe" -print0 \
|
||||
| xargs -0r mv --target-directory="${OUTDIR}"
|
||||
|
||||
# Make .zip from binaries
|
||||
find "${DISTNAME}" -print0 \
|
||||
| xargs -0r touch --no-dereference --date="@${SOURCE_DATE_EPOCH}"
|
||||
find "${DISTNAME}" \
|
||||
| sort \
|
||||
| zip -X@ "${OUTDIR}/${DISTNAME}-${HOST//x86_64-w64-mingw32/win64}.zip" \
|
||||
|| ( rm -f "${OUTDIR}/${DISTNAME}-${HOST//x86_64-w64-mingw32/win64}.zip" && exit 1 )
|
||||
;;
|
||||
*darwin*)
|
||||
# Apply detached codesignatures to dist/ (in-place)
|
||||
signapple apply dist/Bitcoin-Qt.app codesignatures/osx/dist
|
||||
case "$HOST" in
|
||||
arm64*) ARCH="arm64" ;;
|
||||
x86_64*) ARCH="x86_64" ;;
|
||||
esac
|
||||
|
||||
# Apply detached codesignatures (in-place)
|
||||
signapple apply dist/Bitcoin-Qt.app codesignatures/osx/"${HOST}"/dist/Bitcoin-Qt.app
|
||||
find "${DISTNAME}" -wholename "*/bin/*" -type f | while read -r bin
|
||||
do
|
||||
signapple apply "${bin}" "codesignatures/osx/${HOST}/${bin}.${ARCH}sign"
|
||||
done
|
||||
|
||||
# Make a .zip from dist/
|
||||
cd dist/
|
||||
|
@ -91,6 +118,14 @@ mkdir -p "$DISTSRC"
|
|||
| xargs -0r touch --no-dereference --date="@${SOURCE_DATE_EPOCH}"
|
||||
find . | sort \
|
||||
| zip -X@ "${OUTDIR}/${DISTNAME}-${HOST}.zip"
|
||||
cd ..
|
||||
|
||||
# Make a .tar.gz from bins
|
||||
find "${DISTNAME}" -print0 \
|
||||
| sort --zero-terminated \
|
||||
| tar --create --no-recursion --mode='u+rw,go+r-w,a+X' --null --files-from=- \
|
||||
| gzip -9n > "${OUTDIR}/${DISTNAME}-${HOST}.tar.gz" \
|
||||
|| ( rm -f "${OUTDIR}/${DISTNAME}-${HOST}.tar.gz" && exit 1 )
|
||||
;;
|
||||
*)
|
||||
exit 1
|
||||
|
@ -105,7 +140,7 @@ mv --no-target-directory "$OUTDIR" "$ACTUAL_OUTDIR" \
|
|||
(
|
||||
cd /outdir-base
|
||||
{
|
||||
echo "$UNSIGNED_TARBALL"
|
||||
echo "$CODESIGNING_TARBALL"
|
||||
echo "$CODESIGNATURE_GIT_ARCHIVE"
|
||||
find "$ACTUAL_OUTDIR" -type f
|
||||
} | xargs realpath --relative-base="$PWD" \
|
||||
|
|
|
@ -15,13 +15,14 @@
|
|||
(gnu packages mingw)
|
||||
(gnu packages pkg-config)
|
||||
((gnu packages python) #:select (python-minimal))
|
||||
((gnu packages python-build) #:select (python-tomli))
|
||||
((gnu packages python-build) #:select (python-tomli python-poetry-core))
|
||||
((gnu packages python-crypto) #:select (python-asn1crypto))
|
||||
((gnu packages tls) #:select (openssl))
|
||||
((gnu packages version-control) #:select (git-minimal))
|
||||
(guix build-system cmake)
|
||||
(guix build-system gnu)
|
||||
(guix build-system python)
|
||||
(guix build-system pyproject)
|
||||
(guix build-system trivial)
|
||||
(guix download)
|
||||
(guix gexp)
|
||||
|
@ -381,10 +382,10 @@ specific moment in time, whitelisting and revocation checks.")
|
|||
(license license:expat))))
|
||||
|
||||
(define-public python-signapple
|
||||
(let ((commit "62155712e7417aba07565c9780a80e452823ae6a"))
|
||||
(let ((commit "a9bf003d87e17f744a2791b86348abc5377ebed2"))
|
||||
(package
|
||||
(name "python-signapple")
|
||||
(version (git-version "0.1" "1" commit))
|
||||
(version (git-version "0.2.0" "1" commit))
|
||||
(source
|
||||
(origin
|
||||
(method git-fetch)
|
||||
|
@ -394,13 +395,14 @@ specific moment in time, whitelisting and revocation checks.")
|
|||
(file-name (git-file-name name commit))
|
||||
(sha256
|
||||
(base32
|
||||
"1nm6rm4h4m7kbq729si4cm8rzild62mk4ni8xr5zja7l33fhv3gb"))))
|
||||
(build-system python-build-system)
|
||||
"0p250z2ai04a7fgr1b9kmc8samz4bkpqprx3az0k0jp6b310p2nz"))))
|
||||
(build-system pyproject-build-system)
|
||||
(propagated-inputs
|
||||
(list python-asn1crypto
|
||||
python-oscrypto
|
||||
python-certvalidator
|
||||
python-elfesteem))
|
||||
(native-inputs (list python-poetry-core))
|
||||
;; There are no tests, but attempting to run python setup.py test leads to
|
||||
;; problems, just disable the test
|
||||
(arguments '(#:tests? #f))
|
||||
|
|
|
@ -6,26 +6,50 @@
|
|||
export LC_ALL=C
|
||||
set -e
|
||||
|
||||
ROOTDIR=dist
|
||||
BUNDLE="${ROOTDIR}/Bitcoin-Qt.app"
|
||||
BINARY="${BUNDLE}/Contents/MacOS/Bitcoin-Qt"
|
||||
SIGNAPPLE=signapple
|
||||
TEMPDIR=sign.temp
|
||||
ARCH=$(${SIGNAPPLE} info ${BINARY} | head -n 1 | cut -d " " -f 1)
|
||||
OUT="signature-osx-${ARCH}.tar.gz"
|
||||
OUTROOT=osx/dist
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "usage: $0 <signapple args>"
|
||||
echo "example: $0 <path to key>"
|
||||
BUNDLE_ROOT=dist
|
||||
BUNDLE_NAME="Bitcoin-Qt.app"
|
||||
UNSIGNED_BUNDLE="${BUNDLE_ROOT}/${BUNDLE_NAME}"
|
||||
UNSIGNED_BINARY="${UNSIGNED_BUNDLE}/Contents/MacOS/Bitcoin-Qt"
|
||||
|
||||
ARCH=$(file ${UNSIGNED_BINARY} | cut -d " " -f 4)
|
||||
|
||||
OUTDIR="osx/${ARCH}-apple-darwin"
|
||||
OUTROOT="${TEMPDIR}/${OUTDIR}"
|
||||
|
||||
OUT="signature-osx-${ARCH}.tar.gz"
|
||||
|
||||
if [ "$#" -ne 3 ]; then
|
||||
echo "usage: $0 <path to key> <path to app store connect key> <apple developer team uuid>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -rf ${TEMPDIR}
|
||||
mkdir -p ${TEMPDIR}
|
||||
|
||||
${SIGNAPPLE} sign -f --detach "${TEMPDIR}/${OUTROOT}" "$@" "${BUNDLE}" --hardened-runtime
|
||||
stty -echo
|
||||
printf "Enter the passphrase for %s: " "$1"
|
||||
read cs_key_pass
|
||||
printf "\n"
|
||||
printf "Enter the passphrase for %s: " "$2"
|
||||
read api_key_pass
|
||||
printf "\n"
|
||||
stty echo
|
||||
|
||||
tar -C "${TEMPDIR}" -czf "${OUT}" .
|
||||
# Sign and notarize app bundle
|
||||
${SIGNAPPLE} sign -f --hardened-runtime --detach "${OUTROOT}/${BUNDLE_ROOT}" --passphrase "${cs_key_pass}" "$1" "${UNSIGNED_BUNDLE}"
|
||||
${SIGNAPPLE} apply "${UNSIGNED_BUNDLE}" "${OUTROOT}/${BUNDLE_ROOT}/${BUNDLE_NAME}"
|
||||
${SIGNAPPLE} notarize --detach "${OUTROOT}/${BUNDLE_ROOT}" --passphrase "${api_key_pass}" "$2" "$3" "${UNSIGNED_BUNDLE}"
|
||||
|
||||
# Sign each binary
|
||||
find . -wholename "*/bin/*" -type f -exec realpath --relative-to=. {} \; | while read -r bin
|
||||
do
|
||||
bin_dir="$(dirname "${bin}")"
|
||||
${SIGNAPPLE} sign -f --hardened-runtime --detach "${OUTROOT}/${bin_dir}" --passphrase "${cs_key_pass}" "$1" "${bin}"
|
||||
done
|
||||
|
||||
tar -C "${TEMPDIR}" -czf "${OUT}" "${OUTDIR}"
|
||||
rm -rf "${TEMPDIR}"
|
||||
echo "Created ${OUT}"
|
||||
|
|
|
@ -8,9 +8,9 @@ if [ -z "$OSSLSIGNCODE" ]; then
|
|||
OSSLSIGNCODE=osslsigncode
|
||||
fi
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "usage: $0 <osslcodesign args>"
|
||||
echo "example: $0 -key codesign.key"
|
||||
if [ "$#" -ne 1 ]; then
|
||||
echo "usage: $0 <path to key>"
|
||||
echo "example: $0 codesign.key"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
@ -22,12 +22,22 @@ OUTSUBDIR="${OUTDIR}/win"
|
|||
TIMESERVER=http://timestamp.comodoca.com
|
||||
CERTFILE="win-codesign.cert"
|
||||
|
||||
stty -echo
|
||||
printf "Enter the passphrase for %s: " "$1"
|
||||
read cs_key_pass
|
||||
printf "\n"
|
||||
stty echo
|
||||
|
||||
|
||||
mkdir -p "${OUTSUBDIR}"
|
||||
# shellcheck disable=SC2046
|
||||
basename -a $(ls -1 "${SRCDIR}"/*-unsigned.exe) | while read UNSIGNED; do
|
||||
echo Signing "${UNSIGNED}"
|
||||
"${OSSLSIGNCODE}" sign -certs "${CERTFILE}" -t "${TIMESERVER}" -h sha256 -in "${SRCDIR}/${UNSIGNED}" -out "${WORKDIR}/${UNSIGNED}" "$@"
|
||||
"${OSSLSIGNCODE}" extract-signature -pem -in "${WORKDIR}/${UNSIGNED}" -out "${OUTSUBDIR}/${UNSIGNED}.pem" && rm "${WORKDIR}/${UNSIGNED}"
|
||||
find ${SRCDIR} -wholename "*.exe" -type f -exec realpath --relative-to=. {} \; | while read -r bin
|
||||
do
|
||||
echo Signing "${bin}"
|
||||
bin_base="$(realpath --relative-to=${SRCDIR} "${bin}")"
|
||||
mkdir -p "$(dirname ${WORKDIR}/"${bin_base}")"
|
||||
"${OSSLSIGNCODE}" sign -certs "${CERTFILE}" -t "${TIMESERVER}" -h sha256 -in "${bin}" -out "${WORKDIR}/${bin_base}" -key "$1" -pass "${cs_key_pass}"
|
||||
mkdir -p "$(dirname ${OUTSUBDIR}/"${bin_base}")"
|
||||
"${OSSLSIGNCODE}" extract-signature -pem -in "${WORKDIR}/${bin_base}" -out "${OUTSUBDIR}/${bin_base}.pem" && rm "${WORKDIR}/${bin_base}"
|
||||
done
|
||||
|
||||
rm -f "${OUT}"
|
||||
|
|
|
@ -164,8 +164,8 @@ Then open a Pull Request to the [guix.sigs repository](https://github.com/bitcoi
|
|||
|
||||
In the `guix-build-${VERSION}/output/x86_64-apple-darwin` and `guix-build-${VERSION}/output/arm64-apple-darwin` directories:
|
||||
|
||||
tar xf bitcoin-osx-unsigned.tar.gz
|
||||
./detached-sig-create.sh /path/to/codesign.p12
|
||||
tar xf bitcoin-osx-codesigning.tar.gz
|
||||
./detached-sig-create.sh /path/to/codesign.p12 /path/to/AuthKey_foo.p8 uuid
|
||||
Enter the keychain password and authorize the signature
|
||||
signature-osx.tar.gz will be created
|
||||
|
||||
|
@ -173,8 +173,8 @@ In the `guix-build-${VERSION}/output/x86_64-apple-darwin` and `guix-build-${VERS
|
|||
|
||||
In the `guix-build-${VERSION}/output/x86_64-w64-mingw32` directory:
|
||||
|
||||
tar xf bitcoin-win-unsigned.tar.gz
|
||||
./detached-sig-create.sh -key /path/to/codesign.key
|
||||
tar xf bitcoin-win-codesigning.tar.gz
|
||||
./detached-sig-create.sh /path/to/codesign.key
|
||||
Enter the passphrase for the key when prompted
|
||||
signature-win.tar.gz will be created
|
||||
|
||||
|
|
|
@ -421,6 +421,7 @@ void BlockAssembler::addPackageTxs(int& nPackagesSelected, int& nDescendantsUpda
|
|||
}
|
||||
|
||||
++nPackagesSelected;
|
||||
pblocktemplate->m_package_feerates.emplace_back(packageFees, static_cast<int32_t>(packageSize));
|
||||
|
||||
// Update transactions that depend on each of these
|
||||
nDescendantsUpdated += UpdatePackagesForAdded(mempool, ancestors, mapModifiedTx);
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include <policy/policy.h>
|
||||
#include <primitives/block.h>
|
||||
#include <txmempool.h>
|
||||
#include <util/feefrac.h>
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
@ -39,6 +40,9 @@ struct CBlockTemplate
|
|||
std::vector<CAmount> vTxFees;
|
||||
std::vector<int64_t> vTxSigOpsCost;
|
||||
std::vector<unsigned char> vchCoinbaseCommitment;
|
||||
/* A vector of package fee rates, ordered by the sequence in which
|
||||
* packages are selected for inclusion in the block template.*/
|
||||
std::vector<FeeFrac> m_package_feerates;
|
||||
};
|
||||
|
||||
// Container for tracking updates to ancestor feerate as we include (parent)
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <txmempool.h>
|
||||
#include <uint256.h>
|
||||
#include <util/check.h>
|
||||
#include <util/feefrac.h>
|
||||
#include <util/strencodings.h>
|
||||
#include <util/time.h>
|
||||
#include <util/translation.h>
|
||||
|
@ -25,6 +26,7 @@
|
|||
#include <test/util/setup_common.h>
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
|
@ -123,19 +125,22 @@ void MinerTestingSetup::TestPackageSelection(const CScript& scriptPubKey, const
|
|||
tx.vout[0].nValue = 5000000000LL - 1000;
|
||||
// This tx has a low fee: 1000 satoshis
|
||||
Txid hashParentTx = tx.GetHash(); // save this txid for later use
|
||||
AddToMempool(tx_mempool, entry.Fee(1000).Time(Now<NodeSeconds>()).SpendsCoinbase(true).FromTx(tx));
|
||||
const auto parent_tx{entry.Fee(1000).Time(Now<NodeSeconds>()).SpendsCoinbase(true).FromTx(tx)};
|
||||
AddToMempool(tx_mempool, parent_tx);
|
||||
|
||||
// This tx has a medium fee: 10000 satoshis
|
||||
tx.vin[0].prevout.hash = txFirst[1]->GetHash();
|
||||
tx.vout[0].nValue = 5000000000LL - 10000;
|
||||
Txid hashMediumFeeTx = tx.GetHash();
|
||||
AddToMempool(tx_mempool, entry.Fee(10000).Time(Now<NodeSeconds>()).SpendsCoinbase(true).FromTx(tx));
|
||||
const auto medium_fee_tx{entry.Fee(10000).Time(Now<NodeSeconds>()).SpendsCoinbase(true).FromTx(tx)};
|
||||
AddToMempool(tx_mempool, medium_fee_tx);
|
||||
|
||||
// This tx has a high fee, but depends on the first transaction
|
||||
tx.vin[0].prevout.hash = hashParentTx;
|
||||
tx.vout[0].nValue = 5000000000LL - 1000 - 50000; // 50k satoshi fee
|
||||
Txid hashHighFeeTx = tx.GetHash();
|
||||
AddToMempool(tx_mempool, entry.Fee(50000).Time(Now<NodeSeconds>()).SpendsCoinbase(false).FromTx(tx));
|
||||
const auto high_fee_tx{entry.Fee(50000).Time(Now<NodeSeconds>()).SpendsCoinbase(false).FromTx(tx)};
|
||||
AddToMempool(tx_mempool, high_fee_tx);
|
||||
|
||||
std::unique_ptr<BlockTemplate> block_template = mining->createNewBlock(options);
|
||||
BOOST_REQUIRE(block_template);
|
||||
|
@ -145,6 +150,21 @@ void MinerTestingSetup::TestPackageSelection(const CScript& scriptPubKey, const
|
|||
BOOST_CHECK(block.vtx[2]->GetHash() == hashHighFeeTx);
|
||||
BOOST_CHECK(block.vtx[3]->GetHash() == hashMediumFeeTx);
|
||||
|
||||
// Test the inclusion of package feerates in the block template and ensure they are sequential.
|
||||
const auto block_package_feerates = BlockAssembler{m_node.chainman->ActiveChainstate(), &tx_mempool, options}.CreateNewBlock()->m_package_feerates;
|
||||
BOOST_CHECK(block_package_feerates.size() == 2);
|
||||
|
||||
// parent_tx and high_fee_tx are added to the block as a package.
|
||||
const auto combined_txs_fee = parent_tx.GetFee() + high_fee_tx.GetFee();
|
||||
const auto combined_txs_size = parent_tx.GetTxSize() + high_fee_tx.GetTxSize();
|
||||
FeeFrac package_feefrac{combined_txs_fee, combined_txs_size};
|
||||
// The package should be added first.
|
||||
BOOST_CHECK(block_package_feerates[0] == package_feefrac);
|
||||
|
||||
// The medium_fee_tx should be added next.
|
||||
FeeFrac medium_tx_feefrac{medium_fee_tx.GetFee(), medium_fee_tx.GetTxSize()};
|
||||
BOOST_CHECK(block_package_feerates[1] == medium_tx_feefrac);
|
||||
|
||||
// Test that a package below the block min tx fee doesn't get included
|
||||
tx.vin[0].prevout.hash = hashHighFeeTx;
|
||||
tx.vout[0].nValue = 5000000000LL - 1000 - 50000; // 0 fee
|
||||
|
|
Loading…
Reference in a new issue