Merge branch 'FSM' of https://github.com/jl777/komodo into noStreamer

a
This commit is contained in:
blackjok3r
2018-12-03 13:14:23 +08:00
13 changed files with 377 additions and 280 deletions

View File

@@ -1,112 +1,90 @@
stages:
- build
- test
- deploy
########################################################################################################################
####START#### PROJECT LEVEL VARIABLES ####START####
########################################################################################################################
variables:
VERSION: 0.4.0c
VERUS_CLI_LINUX: Verus-CLI-Linux-v${VERSION}.tar.gz
VERUS_CLI_WINDOWS: Verus-CLI-Windows-v${VERSION}.zip
VERUS_CLI_MACOS: Verus-CLI-MacOS-v${VERSION}.tar.gz
DOWNSTREAM_AGAMA_BRANCH: ${CI_COMMIT_REF_NAME}
POST_MESSAGE: "Source: ${CI_PROJECT_NAME}/${CI_COMMIT_REF_NAME}\n
Pipeline Trigger: ${CI_PIPELINE_SOURCE}\n
Commit: ${CI_COMMIT_SHA}$\n
${CI_COMMIT_MESSAGE}"
PACKAGE_DIR_LINUX: linux64
PACKAGE_DIR_WINDOWS: win64
PACKAGE_DIR_MACOS: macos
AGAMA_ARTIFACTS_LINUX: ${PACKAGE_DIR_LINUX}.tar.gz
AGAMA_ARTIFACTS_WINDOWS: ${PACKAGE_DIR_WINDOWS}.zip
AGAMA_ARTIFACTS_MACOS: ${PACKAGE_DIR_MACOS}.tar.gz
AGAMA_ARTIFACTS_LINUX_CHECKSUM: ${AGAMA_ARTIFACTS_LINUX}.md5
AGAMA_ARTIFACTS_WINDOWS_CHECKSUM: ${AGAMA_ARTIFACTS_WINDOWS}.md5
AGAMA_ARTIFACTS_MACOS_CHECKSUM: ${AGAMA_ARTIFACTS_MACOS}.md5
ARTIFACT_EXPIRATION: 1 week
########################################################################################################################
####END#### PROJECT LEVEL VARIABLES ####END####
########################################################################################################################
########################################################################################################################
########################################################################################################################
####START#### Build Stage: compile and package komodo binaries for Verus CLI ####START#####
####START#### Build Stage: compile and package komodo binaries for the Agama Wallet. ####START#####
########################################################################################################################
########################################################################################################################
####START#### LINUX ####START####
########################################################################################################################
build:linux:
image: asherd/verus-builders:verus-ubuntu
build:ubuntu:
stage: build
image: ca333/komodo-builders:komodo-ubuntu
variables:
DOCKER_DRIVER: overlay2
stage: build
cache:
key: "${CI_JOB_NAME}${CI_COMMIT_REF_NAME}"
paths:
- depends/built
script:
- zcutil/build.sh -j$(nproc)
- mkdir verus-cli
- mkdir ${PACKAGE_DIR_LINUX}
- cp src/komodod
src/komodo-cli
src/fiat/verus
src/verusd
doc/man/verus-cli/linux/README.txt
zcutil/fetch-params.sh
verus-cli
- mv verus-cli/fetch-params.sh verus-cli/fetch-params
- chmod +x verus-cli/komodod
- chmod +x verus-cli/komodo-cli
- chmod +x verus-cli/verus
- chmod +x verus-cli/verusd
- chmod +x verus-cli/fetch-params
- if [ "${CI_COMMIT_REF_NAME}" = "master" ]; then strip -g verus-cli/komodod && strip -g verus-cli/komodod; fi
- tar -czvf ${VERUS_CLI_LINUX} verus-cli
- md5sum ${VERUS_CLI_LINUX} > ${VERUS_CLI_LINUX}.md5
- curl -F file=@"${VERUS_CLI_LINUX}"
-F channels="${CLI_POST_CHANNEL}"
-F initial_comment="${POST_MESSAGE}"
-H "${SLACK_BOT_AUTH}"
"https://slack.com/api/files.upload"
src/komodo-cli
${PACKAGE_DIR_LINUX}
- chmod +x ${PACKAGE_DIR_LINUX}/komodod
- chmod +x ${PACKAGE_DIR_LINUX}/komodo-cli
- tar -czvf ${AGAMA_ARTIFACTS_LINUX} ${PACKAGE_DIR_LINUX}
- md5sum ${AGAMA_ARTIFACTS_LINUX} > ${AGAMA_ARTIFACTS_LINUX_CHECKSUM}
artifacts:
paths:
- ${VERUS_CLI_LINUX}
- ${VERUS_CLI_LINUX}.md5
- ${AGAMA_ARTIFACTS_LINUX}
- ${AGAMA_ARTIFACTS_LINUX_CHECKSUM}
expire_in: 1 week
########################################################################################################################
####END#### LINUX ####END####
########################################################################################################################
####START#### WINDOWS ####START####
########################################################################################################################
build:windows:
image: asherd/verus-builders:verus-windows
stage: build
image: ca333/komodo-builders:komodo-windows
variables:
DOCKER_DRIVER: overlay2
stage: build
cache:
key: "${CI_JOB_NAME}${CI_COMMIT_REF_NAME}"
paths:
- depends/built
script:
- zcutil/build-win.sh -j$(nproc)
- mkdir verus-cli
- mkdir ${PACKAGE_DIR_WINDOWS}
- cp src/komodod.exe
src/komodo-cli.exe
src/komodo-tx.exe
src/fiat/verus.bat
src/verusd.bat
doc/man/verus-cli/windows/README.txt
zcutil/fetch-params.bat
zcutil/wget64.exe
verus-cli
- zip -r ${VERUS_CLI_WINDOWS} verus-cli
- md5sum ${VERUS_CLI_WINDOWS} > ${VERUS_CLI_WINDOWS}.md5
- curl -F file=@"${VERUS_CLI_WINDOWS}"
-F channels="${CLI_POST_CHANNEL}"
-F initial_comment="${POST_MESSAGE}"
-H "${SLACK_BOT_AUTH}"
"https://slack.com/api/files.upload"
src/komodo-cli.exe
src/komodo-tx.exe
${PACKAGE_DIR_WINDOWS}
- zip -r ${PACKAGE_DIR_WINDOWS}.zip ${PACKAGE_DIR_WINDOWS}
- md5sum ${AGAMA_ARTIFACTS_WINDOWS} > ${AGAMA_ARTIFACTS_WINDOWS_CHECKSUM}
artifacts:
paths:
- ${VERUS_CLI_WINDOWS}
- ${VERUS_CLI_WINDOWS}.md5
- ${AGAMA_ARTIFACTS_WINDOWS}
- ${AGAMA_ARTIFACTS_WINDOWS_CHECKSUM}
expire_in: 1 week
########################################################################################################################
####END#### WINDOWS ####END####
########################################################################################################################
####START#### MACOS ####START####
########################################################################################################################
build:mac:
build:macos:
stage: build
tags: ["High Sierra"]
cache:
@@ -115,18 +93,13 @@ build:mac:
- depends/built
script:
- zcutil/build-mac.sh -j$(sysctl -n hw.physicalcpu)
- ./makeReleaseMac.sh
- tar -czvf ${VERUS_CLI_MACOS} verus-cli
- md5sum ${VERUS_CLI_MACOS} > ${VERUS_CLI_MACOS}.md5
- curl -F file=@"${VERUS_CLI_MACOS}"
-F channels="${CLI_POST_CHANNEL}"
-F initial_comment="${POST_MESSAGE}"
-H "${SLACK_BOT_AUTH}"
"https://slack.com/api/files.upload"
- ./makeRelease.sh ${PACKAGE_DIR_MACOS}
- tar -czvf ${AGAMA_ARTIFACTS_MACOS} ${PACKAGE_DIR_MACOS}
- md5sum ${AGAMA_ARTIFACTS_MACOS} > ${AGAMA_ARTIFACTS_MACOS_CHECKSUM}
artifacts:
paths:
- ${VERUS_CLI_MACOS}
- ${VERUS_CLI_MACOS}.md5
- ${AGAMA_ARTIFACTS_MACOS}
- ${AGAMA_ARTIFACTS_MACOS_CHECKSUM}
expire_in: 1 week
########################################################################################################################
####END#### MACOS ####END####
@@ -137,13 +110,13 @@ build:mac:
########################################################################################################################
########################################################################################################################
########################################################################################################################
####START#### Test stage: Test functionality of komodo binaries. Produce code quality and SAST reports. ####START####
####START#### Test stage: Produce code quality and static application security test reports. ####START####
########################################################################################################################
########################################################################################################################
########################################################################################################################
####START#### Code Quality ####START####
########################################################################################################################
.code_quality:
code_quality:
image: docker:stable
variables:
DOCKER_DRIVER: overlay2
@@ -165,7 +138,7 @@ build:mac:
########################################################################################################################
####START#### Static Application Security Tests ####START####
########################################################################################################################
.sast:
sast:
image: docker:stable
variables:
DOCKER_DRIVER: overlay2
@@ -185,149 +158,7 @@ build:mac:
####END#### Static Application Security Tests ####END####
########################################################################################################################
########################################################################################################################
####START#### Run Verus CLI on Ubuntu Xenial (16.04) ####START####
########################################################################################################################
.ubuntu:xenial:
image: ubuntu:xenial
variables:
DOCKER_DRIVER: overlay2
stage: test
before_script:
- apt update && apt install -y wget libgomp1 libcurl4-gnutls-dev python
- rm -rf /root/.komodo || true
- mv .komodo /root/ || true
script:
- tar -xzvf ${VERUS_CLI_LINUX}
- export PATH=$PATH:$CI_PROJECT_DIR/verus-cli
- python qa/verus-cli-tests/verus-cli-tester.py
after_script:
- mv /root/.komodo ./ || true
cache:
key: ${CI_JOB_NAME}
paths: [.komodo]
artifacts:
paths: [log.txt]
expire_in: 1 week
dependencies:
- build:linux
########################################################################################################################
####END#### Run Verus CLI on Ubuntu Xenial (16.04) ####END####
####END#### Test stage ####END####
########################################################################################################################
########################################################################################################################
####START#### Run Verus CLI on Ubuntu Bionic (18.04) ####START####
########################################################################################################################
.ubuntu:bionic:
image: ubuntu:bionic
variables:
DOCKER_DRIVER: overlay2
stage: test
before_script:
- apt update && apt install -y wget libgomp1 libcurl4-gnutls-dev python
- rm -rf /root/.komodo || true
- mv .komodo /root/ || true
script:
- tar -xzvf ${VERUS_CLI_LINUX}
- export PATH=$PATH:$CI_PROJECT_DIR/verus-cli
- python qa/verus-cli-tests/verus-cli-tester.py
after_script:
- mv /root/.komodo ./ || true
cache:
key: ${CI_JOB_NAME}
paths: [.komodo]
artifacts:
paths: [log.txt]
expire_in: 1 week
dependencies:
- build:linux
########################################################################################################################
####END#### Run Verus CLI on Ubuntu Bionic (18.04) ####END####
########################################################################################################################
########################################################################################################################
####START#### Run Verus CLI on MacOS Sierra (10.12.6) ####START####
########################################################################################################################
.macos:sierra:
stage: test
tags: ["Sierra"]
script:
- tar -xzvf $VERUS_CLI_MACOS
- export PATH=$PATH:$CI_PROJECT_DIR/verus-cli
- python qa/verus-cli-tests/verus-cli-tester.py
artifacts:
paths: [log.txt]
expire_in: 1 week
dependencies:
- build:mac
########################################################################################################################
####END#### Run Verus CLI on MacOS Sierra (10.12.6) ####END####
########################################################################################################################
########################################################################################################################
####START#### Run Verus CLI on MacOS High Sierra (10.12.6) ####START####
########################################################################################################################
.macos:high-sierra:
stage: test
tags: ["High Sierra"]
script:
- tar -xzvf ${VERUS_CLI_MACOS}
- export PATH=$PATH:$CI_PROJECT_DIR/verus-cli
- python qa/verus-cli-tests/verus-cli-tester.py
artifacts:
paths: [log.txt]
expire_in: 1 week
dependencies:
- build:mac
########################################################################################################################
####START#### Run Verus CLI on MacOS High Sierra (10.12.6) ####START####
########################################################################################################################
########################################################################################################################
####START#### Run Verus CLI on Windows 10 ####START####
########################################################################################################################
.windows:10:
stage: test
tags: ["Windows 10"]
script:
- PowerShell Expand-Archive -Path %VERUS_CLI_WINDOWS% -DestinationPath %CI_PROJECT_DIR%
- set PATH=%PATH%;%CI_PROJECT_DIR%\verus-cli
- qa\verus-cli-tests\verus-cli-tester.py
artifacts:
paths: [log.txt]
expire_in: 1 week
dependencies:
- build:windows
########################################################################################################################
####END#### Run Verus CLI on Windows 10 ####END####
########################################################################################################################
########################################################################################################################
####END#### Test Stage ####END####
########################################################################################################################
########################################################################################################################
####START#### Deploy ####START####
########################################################################################################################
deploy:
stage: deploy
image: google/cloud-sdk:alpine
variables:
DOCKER_DRIVER: overlay2
dependencies:
- build:linux
- build:windows
- build:mac
script:
- mkdir Windows && mkdir Linux && mkdir MacOS &&
mv ${VERUS_CLI_WINDOWS} Windows &&
mv ${VERUS_CLI_LINUX} Linux &&
mv ${VERUS_CLI_MACOS} MacOS
- echo "$AUTH_KEY" > AUTH_KEY.json &&
gcloud auth activate-service-account
--key-file AUTH_KEY.json
- gsutil cp -r Windows Linux MacOS $STAGING/${CI_PROJECT_NAME}/${CI_COMMIT_REF_NAME}/
- curl -X POST
-F token="$CI_JOB_TOKEN"
-F ref="$DOWNSTREAM_AGAMA_BRANCH"
-F variables\[UPSTREAM_TRIGGER_INFO\]="${POST_MESSAGE}"
-F variables\[VERUS_CLI_LINUX\]="${VERUS_CLI_LINUX}"
-F variables\[VERUS_CLI_WINDOWS\]="${VERUS_CLI_WINDOWS}"
-F variables\[VERUS_CLI_MACOS\]="${VERUS_CLI_MACOS}"
"https://gitlab.com/api/v4/projects/8018592/trigger/pipeline"
########################################################################################################################
####END#### Deploy ####END####
########################################################################################################################

View File

@@ -1,29 +1,19 @@
#!/bin/sh
KMD_DIR=verus-cli
mkdir ${KMD_DIR}
cp src/fiat/verus \
src/verusd \
doc/man/verus-cli/mac/README.txt \
zcutil/fetch-params.sh \
verus-cli
mv verus-cli/fetch-params.sh verus-cli/fetch-params
chmod +x ${KMD_DIR}/fetch-params
chmod +x ${KMD_DIR}/verus
chmod +x ${KMD_DIR}/verusd
PACKAGE_DIR="$@"
mkdir ${PACKAGE_DIR}
binaries=("komodo-cli" "komodod")
alllibs=()
for binary in "${binaries[@]}";
do
# do the work in the destination directory
cp src/${binary} ${KMD_DIR}
cp src/${binary} ${PACKAGE_DIR}
# find the dylibs to copy for komodod
DYLIBS=`otool -L ${KMD_DIR}/${binary} | grep "/usr/local" | awk -F' ' '{ print $1 }'`
echo "copying ${DYLIBS} to ${KMD_DIR}"
DYLIBS=`otool -L ${PACKAGE_DIR}/${binary} | grep "/usr/local" | awk -F' ' '{ print $1 }'`
echo "copying ${DYLIBS} to ${PACKAGE_DIR}"
# copy the dylibs to the srcdir
for dylib in ${DYLIBS}; do cp -rf ${dylib} ${KMD_DIR}; done
for dylib in ${DYLIBS}; do cp -rf ${dylib} ${PACKAGE_DIR}; done
done
libraries=("libgcc_s.1.dylib" "libgomp.1.dylib" "libidn2.0.dylib" "libstdc++.6.dylib")
@@ -31,10 +21,10 @@ libraries=("libgcc_s.1.dylib" "libgomp.1.dylib" "libidn2.0.dylib" "libstdc++.6.d
for binary in "${libraries[@]}";
do
# find the dylibs to copy for komodod
DYLIBS=`otool -L ${KMD_DIR}/${binary} | grep "/usr/local" | awk -F' ' '{ print $1 }'`
echo "copying ${DYLIBS} to ${KMD_DIR}"
DYLIBS=`otool -L ${PACKAGE_DIR}/${binary} | grep "/usr/local" | awk -F' ' '{ print $1 }'`
echo "copying ${DYLIBS} to ${PACKAGE_DIR}"
# copy the dylibs to the srcdir
for dylib in ${DYLIBS}; do cp -rf ${dylib} ${KMD_DIR}; alllibs+=(${dylib}); done
for dylib in ${DYLIBS}; do cp -rf ${dylib} ${PACKAGE_DIR}; alllibs+=(${dylib}); done
done
indirectlibraries=("libintl.8.dylib" "libunistring.2.dylib")
@@ -44,10 +34,10 @@ do
# Need to undo this for the dylibs when we are done
chmod 755 src/${binary}
# find the dylibs to copy for komodod
DYLIBS=`otool -L ${KMD_DIR}/${binary} | grep "/usr/local" | awk -F' ' '{ print $1 }'`
echo "copying indirect ${DYLIBS} to ${KMD_DIR}"
DYLIBS=`otool -L ${PACKAGE_DIR}/${binary} | grep "/usr/local" | awk -F' ' '{ print $1 }'`
echo "copying indirect ${DYLIBS} to ${PACKAGE_DIR}"
# copy the dylibs to the dest dir
for dylib in ${DYLIBS}; do cp -rf ${dylib} ${KMD_DIR}; alllibs+=(${dylib}); done
for dylib in ${DYLIBS}; do cp -rf ${dylib} ${PACKAGE_DIR}; alllibs+=(${dylib}); done
done
for binary in "${binaries[@]}";
@@ -57,9 +47,9 @@ do
for dylib in "${alllibs[@]}"
do
echo "Next lib is ${dylib} "
install_name_tool -change ${dylib} @executable_path/`basename ${dylib}` ${KMD_DIR}/${binary}
install_name_tool -change ${dylib} @executable_path/`basename ${dylib}` ${PACKAGE_DIR}/${binary}
done
chmod +x ${KMD_DIR}/${binary}
chmod +x ${PACKAGE_DIR}/${binary}
done
for binary in "${libraries[@]}";
@@ -69,8 +59,6 @@ do
for dylib in "${alllibs[@]}"
do
echo "Next lib is ${dylib} "
install_name_tool -change ${dylib} @executable_path/`basename ${dylib}` ${KMD_DIR}/${binary}
install_name_tool -change ${dylib} @executable_path/`basename ${dylib}` ${PACKAGE_DIR}/${binary}
done
done

2
src/ac/zex Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/bash
./komodo-cli -ac_name=ZEX $1 $2 $3 $4 $5 $6

View File

@@ -1,14 +1,134 @@
[
{
"ac_name": "CFEK",
"ac_supply": "100000",
"ac_reward": "10000000000000",
"ac_staked": "51",
"ac_cc": "102",
"addnode": [
"195.201.137.5",
"195.201.20.230"
]
"ac_name": "REVS",
"ac_supply": "1300000"
},
{
"ac_name": "SUPERNET",
"ac_supply": "816061"
},
{
"ac_name": "DEX",
"ac_supply": "999999"
},
{
"ac_name": "PANGEA",
"ac_supply": "999999"
},
{
"ac_name": "JUMBLR",
"ac_supply": "999999"
},
{
"ac_name": "BET",
"ac_supply": "999999"
},
{
"ac_name": "CRYPTO",
"ac_supply": "999999"
},
{
"ac_name": "HODL",
"ac_supply": "9999999"
},
{
"ac_name": "MSHARK",
"ac_supply": "1400000"
},
{
"ac_name": "BOTS",
"ac_supply": "999999"
},
{
"ac_name": "MGW",
"ac_supply": "999999"
},
{
"ac_name": "COQUI",
"ac_supply": "72000000",
"ac_ccactivate": "200000"
},
{
"ac_name": "WLC",
"ac_supply": "210000000"
},
{
"ac_name": "KV",
"ac_supply": "1000000"
},
{
"ac_name": "CEAL",
"ac_supply": "366666666"
},
{
"ac_name": "MESH",
"ac_supply": "1000007"
},
{
"ac_name": "MNZ",
"ac_supply": "257142858"
},
{
"ac_name": "AXO",
"ac_supply": "200000000"
},
{
"ac_name": "ETOMIC",
"ac_supply": "100000000"
},
{
"ac_name": "BTCH",
"ac_supply": "20998641"
},
{
"ac_name": "PIZZA",
"ac_supply": "100000000"
},
{
"ac_name": "BEER",
"ac_supply": "100000000"
},
{
"ac_name": "NINJA",
"ac_supply": "100000000"
},
{
"ac_name": "OOT",
"ac_supply": "216000000"
},
{
"ac_name": "BNTN",
"ac_supply": "500000000"
},
{
"ac_name": "CHAIN",
"ac_supply": "999999"
},
{
"ac_name": "PRLPAY",
"ac_supply": "500000000"
},
{
"ac_name": "DSEC",
"ac_supply": "7000000"
},
{
"ac_name": "GLXT",
"ac_supply": "10000000000"
},
{
"ac_name": "EQL",
"ac_supply": "500000000",
"ac_ccactivate": "205000"
},
{
"ac_name": "ZILLA",
"ac_supply": "11000000"
},
{
"ac_name": "RFOX",
"ac_supply": "1000000000",
"ac_reward": "100000000"
},
{
"ac_name": "CFEKED",
@@ -76,5 +196,28 @@
"addnode": [
"51.75.124.34"
]
},
{
"ac_name": "KMDICE",
"ac_supply": "10500000",
"ac_reward": "2500000000",
"ac_halving": "210000",
"ac_cc": "2",
"addressindex": "1",
"spentindex": "1",
"addnode": [
"144.76.217.232"
]
},
{
"ac_name": "ZEX",
"ac_founders": "1",
"ac_reward": "13000000000",
"ac_halving": "525600",
"ac_cc": "2",
"ac_pubkey": "039d4a50cc70d1184e462a22edb3b66385da97cc8059196f8305c184a3e21440af",
"addnode": [
"5.9.102.210"
]
}
]

View File

@@ -33,7 +33,7 @@ echo $pubkey
./komodod -pubkey=$pubkey -ac_name=PRLPAY -ac_supply=500000000 -addnode=13.250.226.125 &
./komodod -pubkey=$pubkey -ac_name=DSEC -ac_supply=7000000 -addnode=185.148.147.30 &
./komodod -pubkey=$pubkey -ac_name=GLXT -ac_supply=10000000000 -addnode=13.230.224.15 &
./komodod -pubkey=$pubkey -ac_name=EQL -ac_supply=500000000 -addnode=46.101.124.153 &
./komodod -pubkey=$pubkey -ac_name=EQL -ac_supply=500000000 -ac_ccactivate=205000 -addnode=46.101.124.153 &
./komodod -pubkey=$pubkey -ac_name=ZILLA -ac_supply=11000000 -addnode=54.39.23.248 &
./komodod -pubkey=$pubkey -ac_name=RFOX -ac_supply=1000000000 -ac_reward=100000000 -addnode=78.47.196.146 &
~/VerusCoin/src/komodod -pubkey=$pubkey -ac_name=VRSC -ac_algo=verushash -ac_cc=1 -ac_veruspos=50 -ac_supply=0 -ac_eras=3 -ac_reward=0,38400000000,2400000000 -ac_halving=1,43200,1051920 -ac_decay=100000000,0,0 -ac_end=10080,226080,0 -ac_timelockgte=19200000000 -ac_timeunlockfrom=129600 -ac_timeunlockto=1180800 -addnode=185.25.48.236 -addnode=185.64.105.111 &
@@ -44,3 +44,4 @@ echo $pubkey
./komodod -pubkey=$pubkey -ac_name=PGT -ac_supply=10000000 -ac_end=1 -addnode=190.114.254.104 &
./komodod -pubkey=$pubkey -ac_name=KMDICE -ac_supply=10500000 -ac_reward=2500000000 -ac_halving=210000 -ac_cc=2 -addressindex=1 -spentindex=1 -addnode=144.76.217.232 &
./komodod -pubkey=$pubkey -ac_name=DION -ac_supply=3900000000 -ac_reward=22260000000 -ac_staked=100 -ac_cc=1 -ac_end=4300000000 -addnode=51.75.124.34 &
./komodod -pubkey=$pubkey -ac_name=ZEX -ac_cc=2 -ac_founders=1 -ac_halving=525600 -ac_reward=13000000000 -ac_pubkey=039d4a50cc70d1184e462a22edb3b66385da97cc8059196f8305c184a3e21440af -addnode=5.9.102.210 &

View File

@@ -178,6 +178,7 @@ std::string FinalizeCCTx(uint64_t skipmask,struct CCcontract_info *cp,CMutableTr
void SetCCunspents(std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > &unspentOutputs,char *coinaddr);
void SetCCtxids(std::vector<std::pair<CAddressIndexKey, CAmount> > &addressIndex,char *coinaddr);
int64_t AddNormalinputs(CMutableTransaction &mtx,CPubKey mypk,int64_t total,int32_t maxinputs);
int64_t AddNormalinputs2(CMutableTransaction &mtx,int64_t total,int32_t maxinputs);
int64_t CCutxovalue(char *coinaddr,uint256 utxotxid,int32_t utxovout);
// curve25519 and sha256

View File

@@ -431,3 +431,92 @@ int64_t AddNormalinputs(CMutableTransaction &mtx,CPubKey mypk,int64_t total,int3
#endif
return(0);
}
int64_t AddNormalinputs2(CMutableTransaction &mtx,int64_t total,int32_t maxinputs)
{
int32_t abovei,belowi,ind,vout,i,n = 0,maxutxos=64; int64_t sum,threshold,above,below; int64_t remains,nValue,totalinputs = 0; char coinaddr[64]; uint256 txid,hashBlock; CTransaction tx; struct CC_utxo *utxos,*up;
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
utxos = (struct CC_utxo *)calloc(maxutxos,sizeof(*utxos));
threshold = total/(maxinputs+1);
if ( maxinputs > maxutxos )
maxutxos = maxinputs;
sum = 0;
Getscriptaddress(coinaddr,CScript() << Mypubkey() << OP_CHECKSIG);
SetCCunspents(unspentOutputs,coinaddr);
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
{
txid = it->first.txhash;
vout = (int32_t)it->first.index;
if ( it->second.satoshis < threshold )
continue;
if ( myGetTransaction(txid,tx,hashBlock) != 0 && tx.vout.size() > 0 && vout < tx.vout.size() && tx.vout[vout].scriptPubKey.IsPayToCryptoCondition() == 0 )
{
//fprintf(stderr,"check %.8f to vins array.%d of %d %s/v%d\n",(double)out.tx->vout[out.i].nValue/COIN,n,maxutxos,txid.GetHex().c_str(),(int32_t)vout);
if ( mtx.vin.size() > 0 )
{
for (i=0; i<mtx.vin.size(); i++)
if ( txid == mtx.vin[i].prevout.hash && vout == mtx.vin[i].prevout.n )
break;
if ( i != mtx.vin.size() )
continue;
}
if ( n > 0 )
{
for (i=0; i<n; i++)
if ( txid == utxos[i].txid && vout == utxos[i].vout )
break;
if ( i != n )
continue;
}
if ( myIsutxo_spentinmempool(txid,vout) == 0 )
{
up = &utxos[n++];
up->txid = txid;
up->nValue = it->second.satoshis;
up->vout = vout;
sum += up->nValue;
//fprintf(stderr,"add %.8f to vins array.%d of %d\n",(double)up->nValue/COIN,n,maxutxos);
if ( n >= maxutxos || sum >= total )
break;
}
}
}
remains = total;
for (i=0; i<maxinputs && n>0; i++)
{
below = above = 0;
abovei = belowi = -1;
if ( CC_vinselect(&abovei,&above,&belowi,&below,utxos,n,remains) < 0 )
{
printf("error finding unspent i.%d of %d, %.8f vs %.8f\n",i,n,(double)remains/COIN,(double)total/COIN);
free(utxos);
return(0);
}
if ( belowi < 0 || abovei >= 0 )
ind = abovei;
else ind = belowi;
if ( ind < 0 )
{
printf("error finding unspent i.%d of %d, %.8f vs %.8f, abovei.%d belowi.%d ind.%d\n",i,n,(double)remains/COIN,(double)total/COIN,abovei,belowi,ind);
free(utxos);
return(0);
}
up = &utxos[ind];
mtx.vin.push_back(CTxIn(up->txid,up->vout,CScript()));
totalinputs += up->nValue;
remains -= up->nValue;
utxos[ind] = utxos[--n];
memset(&utxos[n],0,sizeof(utxos[n]));
//fprintf(stderr,"totalinputs %.8f vs total %.8f i.%d vs max.%d\n",(double)totalinputs/COIN,(double)total/COIN,i,maxinputs);
if ( totalinputs >= total || (i+1) >= maxinputs )
break;
}
free(utxos);
if ( totalinputs >= total )
{
//fprintf(stderr,"return totalinputs %.8f\n",(double)totalinputs/COIN);
return(totalinputs);
}
return(0);
}

View File

@@ -1395,7 +1395,7 @@ std::string DiceAddfunding(uint64_t txfee,char *planstr,uint256 fundingtxid,int6
}
if ( scriptPubKey == fundingPubKey )
{
if ( AddNormalinputs(mtx,mypk,amount+2*txfee,60) > 0 )
if ( AddNormalinputs2(mtx,amount+2*txfee,60) > 0 )
{
hentropy = DiceHashEntropy(entropy,mtx.vin[0].prevout.hash,mtx.vin[0].prevout.n,1);
mtx.vout.push_back(MakeCC1vout(cp->evalcode,amount,dicepk));
@@ -1509,7 +1509,7 @@ std::string DiceBetFinish(uint8_t &funcid,uint256 &entropyused,int32_t &entropyv
{
if ( vin0txid == zeroid || vin0vout < 0 )
{
if ( AddNormalinputs(mtx,mypk,2*txfee,3) == 0 ) // must be a single vin!!
if ( AddNormalinputs2(mtx,2*txfee,3) == 0 ) // must be a single vin!!
{
CCerror = "no txfee inputs for win/lose";
fprintf(stderr,"%s\n", CCerror.c_str() );
@@ -1656,22 +1656,32 @@ static uint256 dealer0_fundingtxid;
void *dealer0_loop(void *_arg)
{
char *planstr = (char *)_arg;
CTransaction tx; CPubKey mypk,dicepk; uint64_t entropyval; uint256 entropytxid; int32_t entropytxs,i,n,num; CScript fundingPubKey; struct CCcontract_info *cp,C; char coinaddr[64]; std::string res; int64_t minbet,maxbet,maxodds,timeoutblocks; uint64_t refsbits,txfee = 10000;
CTransaction tx,*entropytxs,entropytx; CPubKey mypk,dicepk; uint64_t entropyval; uint256 hashBlock,entropytxid,txid; int32_t height,lastht,numentropytxs,i,n,m,num; CScript fundingPubKey; struct CCcontract_info *cp,C; char coinaddr[64]; std::string res; int64_t minbet,maxbet,maxodds,timeoutblocks; uint64_t refsbits,txfee = 10000;
if ( (cp= Diceinit(fundingPubKey,dealer0_fundingtxid,&C,planstr,txfee,mypk,dicepk,refsbits,minbet,maxbet,maxodds,timeoutblocks)) == 0 )
{
fprintf(stderr,"error initializing dealer0_loop\n");
exit(-1);
}
fprintf(stderr,"dealer0 node running\n");
height = lastht = 0;
entropytxs = (CTransaction *)calloc(sizeof(*entropytxs),DICE_MINUTXOS);
while ( 1 )
{
DicePlanFunds(entropyval,entropytxid,refsbits,cp,dicepk,dealer0_fundingtxid,entropytxs,false);
if ( entropytxs < DICE_MINUTXOS )
while ( KOMODO_INSYNC == 0 || (height= KOMODO_INSYNC) == lastht )
{
n = sqrt(DICE_MINUTXOS - entropytxs) + 10;
for (i=0; i<DICE_MINUTXOS - entropytxs && i<n; i++)
sleep(3);
}
lastht = height;
fprintf(stderr,"New height.%d\n",height);
DicePlanFunds(entropyval,entropytxid,refsbits,cp,dicepk,dealer0_fundingtxid,numentropytxs,false);
if ( numentropytxs < DICE_MINUTXOS )
{
n = sqrt(DICE_MINUTXOS - numentropytxs);
//if ( n > 10 )
// n = 10;
for (i=m=0; i<DICE_MINUTXOS - numentropytxs && i<n; i++)
{
res = DiceAddfunding(txfee,planstr,dealer0_fundingtxid,1000*COIN);///100);
res = DiceAddfunding(txfee,planstr,dealer0_fundingtxid,COIN);
if ( res.empty() == 0 && res.size() > 64 && is_hexstr((char *)res.c_str(),0) > 64 )
{
if ( DecodeHexTx(tx,res) != 0 )
@@ -1679,12 +1689,37 @@ void *dealer0_loop(void *_arg)
LOCK(cs_main);
if ( myAddtomempool(tx) != 0 )
{
fprintf(stderr,"ENTROPY %s: %d of %d, %d\n",tx.GetHash().GetHex().c_str(),i,n,DICE_MINUTXOS - entropytxs);
fprintf(stderr,"ENTROPY %s: %d of %d, %d\n",tx.GetHash().GetHex().c_str(),i,n,DICE_MINUTXOS - numentropytxs);
RelayTransaction(tx);
entropytxs[m++] = tx;
} else break;
} else break;
} else break;
}
for (i=0; i<m; i++)
{
tx = entropytxs[i];
txid = tx.GetHash();
fprintf(stderr,"check %d of %d: %s\n",i,m,txid.GetHex().c_str());
while ( 1 )
{
if ( myGetTransaction(txid,entropytx,hashBlock) == 0 || hashBlock == zeroid )
{
LOCK(cs_main);
if ( myAddtomempool(tx) != 0 )
{
fprintf(stderr,"resend ENTROPY %s: %d of %d\n",txid.GetHex().c_str(),i,m);
RelayTransaction(tx);
}
}
else
{
fprintf(stderr,"found %s in %s\n",txid.GetHex().c_str(),hashBlock.GetHex().c_str());
break;
}
sleep(10);
}
}
}
pubkey2addr(coinaddr,Mypubkey().data());
dicefinish_utxosget(num,0,0,coinaddr);

2
src/fiat/zex Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/bash
./komodo-cli -ac_name=ZEX $1 $2 $3 $4 $5 $6

View File

@@ -1767,12 +1767,12 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
{
if ( (is_PoSblock= komodo_is_PoSblock(slowflag,height,pblock,bnTarget,bhash)) == 0 )
{
if ( slowflag == 0 ) // need all past 100 blocks to calculate PoW target
return(0);
if ( ASSETCHAINS_STAKED == 100 && height > 100 ) // only PoS allowed! POSTEST64
return(-1);
else
{
if ( slowflag == 0 ) // need all past 100 blocks to calculate PoW target
return(0);
if ( slowflag != 0 )
bnTarget = komodo_PoWtarget(&PoSperc,bnTarget,height,ASSETCHAINS_STAKED);
if ( bhash > bnTarget )
@@ -1792,6 +1792,8 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
fprintf(stderr,"unexpected negative is_PoSblock.%d\n",is_PoSblock);
return(-1);
}
else if ( ASSETCHAINS_STAKED != 0 )
failed = 0;
}
if ( failed == 0 && ASSETCHAINS_COMMISSION != 0 ) //ASSETCHAINS_OVERRIDE_PUBKEY33[0] != 0 )
{
@@ -1820,7 +1822,7 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height)
return(-1);
}
}
//fprintf(stderr,"komodo_checkPOW possible.%d slowflag.%d ht.%d notaryid.%d failed.%d\n",possible,slowflag,height,notaryid,failed);
//fprintf(stderr,"komodo_checkPOW possible.%d slowflag.%d ht.%d notaryid.%d failed.%d\n",possible,slowflag,height,notaryid,failed);
if ( failed != 0 && possible == 0 && notaryid < 0 )
return(-1);
else return(0);

View File

@@ -2013,6 +2013,7 @@ bool myAddtomempool(CTransaction &tx, CValidationState *pstate)
bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock)
{
memset(&hashBlock,0,sizeof(hashBlock));
// need a GetTransaction without lock so the validation code for assets can run without deadlock
{
//fprintf(stderr,"check mempool\n");
@@ -2056,6 +2057,7 @@ bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlo
bool GetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock, bool fAllowSlow)
{
CBlockIndex *pindexSlow = NULL;
memset(&hashBlock,0,sizeof(hashBlock));
LOCK(cs_main);

View File

@@ -491,8 +491,6 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
uint64_t txfees,utxovalue; uint32_t txtime; uint256 utxotxid; int32_t i,siglen,numsigs,utxovout; uint8_t utxosig[128],*ptr;
CMutableTransaction txStaked = CreateNewContextualCMutableTransaction(Params().GetConsensus(), stakeHeight);
//if ( blocktime > pindexPrev->GetMedianTimePast()+60 )
// blocktime = pindexPrev->GetMedianTimePast() + 60;
if (ASSETCHAINS_LWMAPOS != 0)
{
uint32_t nBitsPOS;
@@ -507,6 +505,9 @@ CBlockTemplate* CreateNewBlock(const CScript& _scriptPubKeyIn, int32_t gpucount,
}
else
{
blocktime = GetAdjustedTime();
//if ( blocktime > pindexPrev->GetMedianTimePast()+60 )
// blocktime = pindexPrev->GetMedianTimePast() + 60;
siglen = komodo_staked(txStaked, pblock->nBits, &blocktime, &txtime, &utxotxid, &utxovout, &utxovalue, utxosig);
}

View File

@@ -5185,8 +5185,10 @@ struct komodo_staking *komodo_addutxo(struct komodo_staking *array,int32_t *numk
{
*maxkp += 1000;
array = (struct komodo_staking *)realloc(array,sizeof(*array) * (*maxkp));
//fprintf(stderr,"realloc max.%d array.%p\n",*maxkp,array);
}
kp = &array[(*numkp)++];
//fprintf(stderr,"kp.%p num.%d\n",kp,*numkp);
memset(kp,0,sizeof(*kp));
strcpy(kp->address,address);
kp->txid = txid;
@@ -5209,15 +5211,11 @@ arith_uint256 _komodo_eligible(struct komodo_staking *kp,arith_uint256 ratio,uin
diff = 3600*24*30;
if ( iter > 0 )
diff += segid*2;
coinage = ((uint64_t)kp->nValue/COIN * diff);
coinage = ((uint64_t)kp->nValue * diff);
if ( blocktime+iter+segid*2 > prevtime+480 )
coinage *= ((blocktime+iter+segid*2) - (prevtime+400));
//if ( nHeight >= 2500 && blocktime+iter+segid*2 > prevtime+180 )
// coinage *= ((blocktime+iter+segid*2) - (prevtime+60));
coinage256 = arith_uint256(coinage+1);
hashval = ratio * (kp->hashval / coinage256);
//if ( nHeight >= 900 && nHeight < 916 )
// hashval = (hashval / coinage256);
return(hashval);
}
@@ -5247,7 +5245,7 @@ uint32_t komodo_eligible(arith_uint256 bnTarget,arith_uint256 ratio,struct komod
return(blocktime);
}
}
}
} else fprintf(stderr,"maxiters is not good enough\n");
return(0);
}
@@ -5274,10 +5272,10 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt
if ( (minage= nHeight*3) > 6000 ) // about 100 blocks
minage = 6000;
komodo_segids(hashbuf,nHeight-101,100);
if ( *blocktimep > tipindex->nTime+60 )
if ( *blocktimep < tipindex->nTime+60 )
*blocktimep = tipindex->nTime+60;
//fprintf(stderr,"Start scan of utxo for staking %u ht.%d\n",(uint32_t)time(NULL),nHeight);
if ( time(NULL) > lasttime+600 )
if ( time(NULL) > lasttime+600 || array == 0 )
{
if ( array != 0 )
{
@@ -5296,7 +5294,7 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt
counter++;
if ( out.nDepth < nMinDepth || out.nDepth > nMaxDepth )
{
//fprintf(stderr,"komodo_staked invalid depth %d\n",(int32_t)out.nDepth);
fprintf(stderr,"komodo_staked invalid depth %d\n",(int32_t)out.nDepth);
continue;
}
CAmount nValue = out.tx->vout[out.i].nValue;
@@ -5310,12 +5308,14 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt
if ( GetTransaction(out.tx->GetHash(),tx,hashBlock,true) != 0 && (pindex= komodo_getblockindex(hashBlock)) != 0 )
{
array = komodo_addutxo(array,&numkp,&maxkp,(uint32_t)pindex->nTime,(uint64_t)nValue,out.tx->GetHash(),out.i,(char *)CBitcoinAddress(address).ToString().c_str(),hashbuf,(CScript)pk);
//fprintf(stderr,"addutxo numkp.%d vs max.%d\n",numkp,maxkp);
}
}
}
lasttime = (uint32_t)time(NULL);
//fprintf(stderr,"finished kp data of utxo for staking %u ht.%d numkp.%d maxkp.%d\n",(uint32_t)time(NULL),nHeight,numkp,maxkp);
//fprintf(stderr,"finished kp data of utxo for staking %u ht.%d numkp.%d maxkp.%d\n",(uint32_t)time(NULL),nHeight,numkp,maxkp);
}
//fprintf(stderr,"numkp.%d blocktime.%u\n",numkp,*blocktimep);
block_from_future_rejecttime = (uint32_t)GetAdjustedTime() + 57;
for (i=winners=0; i<numkp; i++)
{
@@ -5328,7 +5328,7 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt
if ( (eligible2= komodo_eligible(bnTarget,ratio,kp,nHeight,*blocktimep,(uint32_t)tipindex->nTime+27,minage,hashbuf)) == 0 )
continue;
eligible = komodo_stake(0,bnTarget,nHeight,kp->txid,kp->vout,0,(uint32_t)tipindex->nTime+27,kp->address);
//fprintf(stderr,"i.%d %u vs %u\n",i,eligible2,eligible);
//fprintf(stderr,"i.%d %u vs %u\n",i,eligible2,eligible);
if ( eligible > 0 )
{
besttime = m = 0;
@@ -5341,7 +5341,7 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt
if ( eligible < block_from_future_rejecttime ) // nothing gained by going earlier
break;
m++;
//fprintf(stderr,"m.%d ht.%d validated winning blocktime %u -> %.8f eligible.%u test prior\n",m,nHeight,*blocktimep,(double)kp->nValue/COIN,eligible);
//fprintf(stderr,"m.%d ht.%d validated winning blocktime %u -> %.8f eligible.%u test prior\n",m,nHeight,*blocktimep,(double)kp->nValue/COIN,eligible);
}
}
else
@@ -5351,7 +5351,7 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt
}
eligible = besttime;
winners++;
//fprintf(stderr,"ht.%d validated winning [%d] -> %.8f eligible.%u test prior\n",nHeight,(int32_t)(eligible - tipindex->nTime),(double)kp->nValue/COIN,eligible);
//fprintf(stderr,"ht.%d validated winning [%d] -> %.8f eligible.%u test prior\n",nHeight,(int32_t)(eligible - tipindex->nTime),(double)kp->nValue/COIN,eligible);
if ( earliest == 0 || eligible < earliest || (eligible == earliest && (*utxovaluep == 0 || kp->nValue < *utxovaluep)) )
{
earliest = eligible;
@@ -5364,7 +5364,7 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt
fprintf(stderr,"ht.%d earliest.%u [%d].%d (%s) nValue %.8f locktime.%u counter.%d winners.%d\n",nHeight,earliest,(int32_t)(earliest - tipindex->nTime),m,kp->address,(double)kp->nValue/COIN,*txtimep,counter,winners);
}
} //else fprintf(stderr,"utxo not eligible\n");
} //else fprintf(stderr,"no tipindex\n");
}
if ( numkp < 10000 && array != 0 )
{
free(array);
@@ -5399,7 +5399,7 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt
for (i=0; i<siglen; i++)
utxosig[i] = ptr[i];//, fprintf(stderr,"%02x",ptr[i]);
//fprintf(stderr," siglen.%d\n",siglen);
//fprintf(stderr,"best %u from %u, gap %d lag.%d\n",earliest,*blocktimep,(int32_t)(earliest - *blocktimep),(int32_t)(time(NULL) - *blocktimep));
//fprintf(stderr,"best %u from %u, gap %d lag.%d\n",earliest,*blocktimep,(int32_t)(earliest - *blocktimep),(int32_t)(time(NULL) - *blocktimep));
*blocktimep = earliest;
}
} //else fprintf(stderr,"no earliest utxo for staking\n");