Skip to content
Permalink
Browse files

blkmaker/slparser/docker for UB: update to 2.5.0.1 for hardfork #813500

  • Loading branch information...
SwimmingTiger committed May 24, 2019
1 parent d2e8dca commit 7c089dd7011a9f45e6658113ad7c9c6be2922cf5
@@ -71,7 +71,7 @@ RUN cd /usr/local/lib && \
find . | grep 'rdkafka' | grep '.so' | xargs rm

# Build blockchain
RUN mkdir /work && git clone https://github.com/btccom/UnitedBitcoin.git --branch 2.3.0.1-openssl-1.1.x --depth 1 /work/blockchain && \
RUN mkdir /work && git clone https://github.com/btccom/UnitedBitcoin.git --branch v2.5.0.1-1 --depth 1 /work/blockchain && \
cd /work/blockchain && ./autogen.sh && ./configure --with-incompatible-bdb --with-gui=no --disable-tests --disable-bench && make && \
cd /work/blockchain/src/secp256k1 && ./autogen.sh && ./configure --enable-module-recovery && make

@@ -39,7 +39,7 @@ docker build -t btccom/btcpool_build:btc-0.16.3 -f Dockerfile.btc --build-arg BU
docker build -t btccom/btcpool_build:bch-0.18.5 -f Dockerfile.bch --build-arg BUILD_JOBS=$(nproc) .
# UBTC
docker build -t btccom/btcpool_build:ubtc-2.3.0.1 -f Dockerfile.ubtc --build-arg BUILD_JOBS=$(nproc) .
docker build -t btccom/btcpool_build:ubtc-2.5.0.1-1 -f Dockerfile.ubtc --build-arg BUILD_JOBS=$(nproc) .
# SBTC (outdated)
docker build -t btccom/btcpool_build:sbtc-0.16.2 -f Dockerfile.sbtc --build-arg BUILD_JOBS=$(nproc) .
@@ -42,7 +42,7 @@ docker build -t btccom/btcpool-btc -f Dockerfile --build-arg BASE_IMAGE=btccom/b
docker build -t btccom/btcpool-bch -f Dockerfile --build-arg BASE_IMAGE=btccom/btcpool_build:bch-0.18.5 --build-arg BUILD_JOBS=$(nproc) ../../..
# UBTC
docker build -t btccom/btcpool-ubtc -f Dockerfile --build-arg BASE_IMAGE=btccom/btcpool_build:ubtc-2.3.0.1 --build-arg BUILD_JOBS=$(nproc) ../../..
docker build -t btccom/btcpool-ubtc -f Dockerfile --build-arg BASE_IMAGE=btccom/btcpool_build:ubtc-2.5.0.1-1 --build-arg BUILD_JOBS=$(nproc) ../../..
# SBTC (outdated)
docker build -t btccom/btcpool-sbtc -f Dockerfile --build-arg BASE_IMAGE=btccom/btcpool_build:sbtc-0.16.2 --build-arg BUILD_JOBS=$(nproc) ../../..
@@ -127,7 +127,7 @@ cd btcpool
mkdir build
cd build
# Release build with 4 jobs:
# Release build:
cmake -DJOBS=4 -DCHAIN_TYPE=BTC -DCHAIN_SRC_ROOT=/work/bitcoin-0.16.0 ..
make -j$(nproc)
@@ -153,7 +153,7 @@ cd btcpool
mkdir build
cd build
# Release build with 4 jobs:
# Release build:
cmake -DJOBS=4 -DCHAIN_TYPE=BCH -DCHAIN_SRC_ROOT=/work/bitcoin-abc-0.18.5 ..
make -j$(nproc)
@@ -182,7 +182,7 @@ cd btcpool
mkdir build
cd build
# Release build with 4 jobs:
# Release build:
cmake -DJOBS=4 -DCHAIN_TYPE=BSV -DCHAIN_SRC_ROOT=/work/bitcoin-sv-0.1.0 ..
make -j$(nproc)
@@ -200,8 +200,10 @@ make -j$(nproc)
```bash
mkdir /work
cd /work
wget -O UnitedBitcoin-2.5.0.1.tar.gz https://github.com/UnitedBitcoin/UnitedBitcoin/archive/v2.5.0.1.tar.gz
tar zxf UnitedBitcoin-2.5.0.1.tar.gz
# Notice: v2.5.0.1-1.tar.gz from UnitedBitcoin official is wrong (missing one commit),
# So here we use the release of our own fork.
wget -O UnitedBitcoin-2.5.0.1-1.tar.gz https://github.com/btccom/UnitedBitcoin/archive/v2.5.0.1-1.tar.gz
tar zxf UnitedBitcoin-2.5.0.1-1.tar.gz
# install libdb that UnitedBitcoin's wallet required
apt-get install -y software-properties-common
@@ -210,7 +212,7 @@ apt-get -y update
apt-get install -y libdb4.8-dev libdb4.8++-dev
# UnitedBitcoin will build failed with `--disable-wallet`, so we have to build it manually with wallet
cd UnitedBitcoin-2.5.0.1
cd UnitedBitcoin-2.5.0.1-1
./autogen.sh
./configure --disable-bench --disable-tests
make -j$(nproc)
@@ -221,16 +223,16 @@ cd btcpool
mkdir build
cd build
# Release build with 4 jobs:
cmake -DJOBS=4 -DCHAIN_TYPE=UBTC -DCHAIN_SRC_ROOT=/work/UnitedBitcoin-2.5.0.1 ..
# Release build:
cmake -DJOBS=4 -DCHAIN_TYPE=UBTC -DCHAIN_SRC_ROOT=/work/UnitedBitcoin-2.5.0.1-1 ..
make -j$(nproc)
# Release build at macOS:
cmake -DCHAIN_TYPE=UBTC -DCHAIN_SRC_ROOT=/work/UnitedBitcoin-2.5.0.1 -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl ..
cmake -DCHAIN_TYPE=UBTC -DCHAIN_SRC_ROOT=/work/UnitedBitcoin-2.5.0.1-1 -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl ..
make -j$(nproc)
# Debug build:
cmake -DCMAKE_BUILD_TYPE=Debug -DCHAIN_TYPE=UBTC -DCHAIN_SRC_ROOT=/work/UnitedBitcoin-2.5.0.1 ..
cmake -DCMAKE_BUILD_TYPE=Debug -DCHAIN_TYPE=UBTC -DCHAIN_SRC_ROOT=/work/UnitedBitcoin-2.5.0.1-1 ..
make -j$(nproc)
```

@@ -253,7 +255,7 @@ cd btcpool
mkdir build
cd build
# Release build with 4 jobs:
# Release build:
cmake -DJOBS=4 -DCHAIN_TYPE=SBTC -DCHAIN_SRC_ROOT=/work/SuperBitcoin-0.17.1 ..
make -j$(nproc)
@@ -279,7 +281,7 @@ cd btcpool
mkdir build
cd build
# Release build with 4 jobs:
# Release build:
cmake -DJOBS=4 -DCHAIN_TYPE=LTC -DCHAIN_SRC_ROOT=/work/litecoin-0.16.3 ..
make -j$(nproc)
@@ -301,7 +303,7 @@ cd btcpool
mkdir build
cd build
# Release build with 4 jobs:
# Release build:
cmake -DJOBS=4 -DCHAIN_TYPE=ZEC -DCHAIN_SRC_ROOT=/work/zcash-2.0.4 ..
make -j$(nproc)
@@ -252,14 +252,42 @@ int64_t GetBlockReward(int nHeight, const Consensus::Params &consensusParams) {
if (nHeight < Params().GetConsensus().ForkV1Height) {
halvings = nHeight / consensusParams.nSubsidyHalvingInterval;
// Force block reward to zero when right shift is undefined.
if (halvings >= 64) {
if (halvings >= 64)
return 0;

CAmount nSubsidy = 50 * COIN;
// Subsidy is cut in half every 210,000 blocks which will occur
// approximately every 4 years.
nSubsidy >>= halvings;
return nSubsidy;
} else if (
nHeight >= Params().GetConsensus().ForkV1Height &&
nHeight < Params().GetConsensus().ForkV4Height) {
int halfPeriodLeft = consensusParams.ForkV1Height - 1 -
consensusParams.nSubsidyHalvingInterval * 2;
int halfPeriodRight =
(consensusParams.nSubsidyHalvingInterval - halfPeriodLeft) * 10;

int PeriodEndHeight = consensusParams.ForkV1Height - 1 +
(consensusParams.nSubsidyHalvingInterval - halfPeriodLeft) * 10;
if (nHeight <= PeriodEndHeight)
halvings = 2;
else {
halvings = 3 +
(nHeight - PeriodEndHeight - 1) /
(consensusParams.nSubsidyHalvingInterval * 10);
}

int64_t nSubsidy = 50 * COIN_TO_SATOSHIS;
// Force block reward to zero when right shift is undefined.
if (halvings >= 64)
return 0;

CAmount nSubsidy = 50 * COIN;
// Subsidy is cut in half every 210,000 blocks which will occur
// approximately every 4 years.
nSubsidy >>= halvings;
nSubsidy = nSubsidy / 10 * 0.8;

return nSubsidy;
} else {
int halfPeriodLeft = consensusParams.ForkV1Height - 1 -
@@ -278,15 +306,14 @@ int64_t GetBlockReward(int nHeight, const Consensus::Params &consensusParams) {
}

// Force block reward to zero when right shift is undefined.
if (halvings >= 64) {
if (halvings >= 64)
return 0;
}

int64_t nSubsidy = 50 * COIN_TO_SATOSHIS;
CAmount nSubsidy = 50 * COIN;
// Subsidy is cut in half every 210,000 blocks which will occur
// approximately every 4 years.
nSubsidy >>= halvings;
nSubsidy = nSubsidy / 10 * 0.8;
nSubsidy = nSubsidy / 10 * 0.4;

return nSubsidy;
}
@@ -95,12 +95,14 @@ TEST(BitcoinUtils, GetBlockRewardBitcoin) {
TestBitcoinBlockReward(629999, 100000000); // 1 UBTC
TestBitcoinBlockReward(630000, 100000000); // 1 UBTC
TestBitcoinBlockReward(700000, 100000000); // 1 UBTC
TestBitcoinBlockReward(5000000, 25000000); // 0.25 UBTC
TestBitcoinBlockReward(6719999, 12500000); // 0.125 UBTC
TestBitcoinBlockReward(6720000, 12500000); // 0.125 UBTC
TestBitcoinBlockReward(6929999, 12500000); // 0.125 UBTC
TestBitcoinBlockReward(6930000, 12500000); // 0.125 UBTC
TestBitcoinBlockReward(13300000, 1562500); // 0.015625 UBTC
TestBitcoinBlockReward(813499, 100000000); // 1 UBTC
TestBitcoinBlockReward(813500, 50000000); // 0.5 UBTC
TestBitcoinBlockReward(5000000, 12500000); // 0.25 UBTC
TestBitcoinBlockReward(6719999, 6250000); // 0.125 UBTC
TestBitcoinBlockReward(6720000, 6250000); // 0.125 UBTC
TestBitcoinBlockReward(6929999, 6250000); // 0.125 UBTC
TestBitcoinBlockReward(6930000, 6250000); // 0.125 UBTC
TestBitcoinBlockReward(13300000, 781250); // 0.015625 UBTC
#else
TestBitcoinBlockReward(629999, 1250000000); // 12.5 BTC
TestBitcoinBlockReward(630000, 625000000); // 6.25 BTC

0 comments on commit 7c089dd

Please sign in to comment.
You can’t perform that action at this time.