From 6c6c6e3f3a20b5d3b8b05cce6d1ee88c834be7d1 Mon Sep 17 00:00:00 2001 From: SHossain Date: Sun, 30 Sep 2018 20:03:11 +0100 Subject: [PATCH 01/38] Update README.md --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e8ed8c3cb..bb0f1336b 100644 --- a/README.md +++ b/README.md @@ -9,14 +9,16 @@ This is the official Komodo sourcecode repository based on https://github.com/jl ## Development Resources + - Komodo Website: [https://komodoplatform.com/](https://komodoplatform.com/) -- Komodo Blockexplorer: [https://kmdexplorer.io//](https://https://kmdexplorer.io/) +- Komodo Blockexplorer: [https://kmdexplorer.io//](https://kmdexplorer.io/) +- Komodo Discord: [https://komodoplatform.com/discord](https://komodoplatform.com/discord) - Forum: [https://forum.komodoplatform.com/](https://forum.komodoplatform.com/) - Mail: [info@komodoplatform.com](mailto:info@komodoplatform.com) - Support: [https://support.komodoplatform.com/support/home](https://support.komodoplatform.com/support/home) -- Knowledgebase & How-to: [https://komodoplatform.atlassian.net/wiki/spaces/KPSD/pages](https://komodoplatform.atlassian.net/wiki/spaces/KPSD/pages) -- API references: [http://docs.komodoplatform.com/](http://docs.komodoplatform.com/) -- Blog: [http://blog.komodoplatform.com/](http://blog.komodoplatform.com/) +- Knowledgebase & How-to: [https://support.komodoplatform.com/en/support/solutions](https://support.komodoplatform.com/en/support/solutions) +- API references & Dev Documentation: [https://docs.komodoplatform.com/](https://docs.komodoplatform.com/) +- Blog: [https://blog.komodoplatform.com/](https://blog.komodoplatform.com/) - Whitepaper: [Komodo Whitepaper](https://komodoplatform.com/wp-content/uploads/2018/03/2018-03-12-Komodo-White-Paper-Full.pdf) - Komodo Platform public material: [Komodo Platform public material](https://docs.google.com/document/d/1AbhWrtagu4vYdkl-vsWz-HSNyNvK-W-ZasHCqe7CZy0) From 063cb75729859bbc45ef7e80b2e08b1251996aba Mon Sep 17 00:00:00 2001 From: SHossain Date: Mon, 1 Oct 2018 10:52:08 +0100 Subject: [PATCH 02/38] Update README.md --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index bb0f1336b..2a5ed62eb 100644 --- a/README.md +++ b/README.md @@ -10,16 +10,16 @@ This is the official Komodo sourcecode repository based on https://github.com/jl ## Development Resources -- Komodo Website: [https://komodoplatform.com/](https://komodoplatform.com/) -- Komodo Blockexplorer: [https://kmdexplorer.io//](https://kmdexplorer.io/) +- Komodo Website: [https://komodoplatform.com](https://komodoplatform.com/) +- Komodo Blockexplorer: [https://kmdexplorer.io](https://kmdexplorer.io/) - Komodo Discord: [https://komodoplatform.com/discord](https://komodoplatform.com/discord) -- Forum: [https://forum.komodoplatform.com/](https://forum.komodoplatform.com/) +- Forum: [https://forum.komodoplatform.com](https://forum.komodoplatform.com/) - Mail: [info@komodoplatform.com](mailto:info@komodoplatform.com) - Support: [https://support.komodoplatform.com/support/home](https://support.komodoplatform.com/support/home) - Knowledgebase & How-to: [https://support.komodoplatform.com/en/support/solutions](https://support.komodoplatform.com/en/support/solutions) -- API references & Dev Documentation: [https://docs.komodoplatform.com/](https://docs.komodoplatform.com/) -- Blog: [https://blog.komodoplatform.com/](https://blog.komodoplatform.com/) -- Whitepaper: [Komodo Whitepaper](https://komodoplatform.com/wp-content/uploads/2018/03/2018-03-12-Komodo-White-Paper-Full.pdf) +- API references & Dev Documentation: [https://docs.komodoplatform.com](https://docs.komodoplatform.com/) +- Blog: [https://blog.komodoplatform.com](https://blog.komodoplatform.com/) +- Whitepaper: [Komodo Whitepaper](https://komodoplatform.com/whitepaper) - Komodo Platform public material: [Komodo Platform public material](https://docs.google.com/document/d/1AbhWrtagu4vYdkl-vsWz-HSNyNvK-W-ZasHCqe7CZy0) ## List of Komodo Platform Technologies From 6da472c874ac57c2828c36b6737dfbb940f31060 Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Mon, 12 Nov 2018 09:14:13 -0500 Subject: [PATCH 03/38] add ZEX --- src/ac/zex | 2 ++ src/assetchains.json | 11 +++++++++++ src/assetchains.old | 1 + 3 files changed, 14 insertions(+) create mode 100755 src/ac/zex diff --git a/src/ac/zex b/src/ac/zex new file mode 100755 index 000000000..f4573c093 --- /dev/null +++ b/src/ac/zex @@ -0,0 +1,2 @@ +#!/bin/bash +./komodo-cli -ac_name=ZEX $1 $2 $3 $4 $5 $6 diff --git a/src/assetchains.json b/src/assetchains.json index d26f3a99a..ca661f441 100644 --- a/src/assetchains.json +++ b/src/assetchains.json @@ -186,5 +186,16 @@ "addnode": [ "51.75.124.34" ] + }, + { + "ac_name": "ZEX", + "ac_founders": "1", + "ac_reward": "13000000000", + "ac_halving": "525600", + "ac_cc": "2", + "ac_pubkey": "039d4a50cc70d1184e462a22edb3b66385da97cc8059196f8305c184a3e21440af", + "addnode": [ + "5.9.102.21" + ] } ] diff --git a/src/assetchains.old b/src/assetchains.old index 42a1effb6..217e0b2a3 100755 --- a/src/assetchains.old +++ b/src/assetchains.old @@ -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.21 & From 48881a752965402fa30a01eddb5319d4f14186d4 Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Mon, 12 Nov 2018 09:28:37 -0500 Subject: [PATCH 04/38] add ZEX fiat script --- src/fiat/zex | 2 ++ 1 file changed, 2 insertions(+) create mode 100755 src/fiat/zex diff --git a/src/fiat/zex b/src/fiat/zex new file mode 100755 index 000000000..f4573c093 --- /dev/null +++ b/src/fiat/zex @@ -0,0 +1,2 @@ +#!/bin/bash +./komodo-cli -ac_name=ZEX $1 $2 $3 $4 $5 $6 From 6dfdb96cf2c5eab07bf7675ee5f74bfc80312d33 Mon Sep 17 00:00:00 2001 From: Mihail Fedorov Date: Tue, 13 Nov 2018 20:34:16 +0300 Subject: [PATCH 05/38] KMDICE coming back --- src/assetchains.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/assetchains.json b/src/assetchains.json index ca661f441..6451db701 100644 --- a/src/assetchains.json +++ b/src/assetchains.json @@ -188,6 +188,18 @@ ] }, { + "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", From 33d6425c0eb0c938f11218a5f0e468f5c4cabf23 Mon Sep 17 00:00:00 2001 From: Alrighttt Date: Wed, 14 Nov 2018 10:41:08 -0500 Subject: [PATCH 06/38] fix ZEX seed node --- src/assetchains.json | 2 +- src/assetchains.old | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/assetchains.json b/src/assetchains.json index 6451db701..44885c9d4 100644 --- a/src/assetchains.json +++ b/src/assetchains.json @@ -207,7 +207,7 @@ "ac_cc": "2", "ac_pubkey": "039d4a50cc70d1184e462a22edb3b66385da97cc8059196f8305c184a3e21440af", "addnode": [ - "5.9.102.21" + "5.9.102.210" ] } ] diff --git a/src/assetchains.old b/src/assetchains.old index 217e0b2a3..29f14198c 100755 --- a/src/assetchains.old +++ b/src/assetchains.old @@ -44,4 +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.21 & +./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 & From 20d588a2dfa2aa7b0773b4f9e201925d7aa78692 Mon Sep 17 00:00:00 2001 From: ca333 Date: Sun, 25 Nov 2018 17:01:39 +0100 Subject: [PATCH 07/38] update gitlab CI conf komodify gitlab CI conf --- .gitlab-ci.yml | 259 +++++++++---------------------------------------- 1 file changed, 45 insertions(+), 214 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b26399a9c..3ace05cb9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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#### -######################################################################################################################## From 3257a9668840a976c076b7219f3ad8ee818eb73c Mon Sep 17 00:00:00 2001 From: ca333 Date: Sun, 25 Nov 2018 17:06:32 +0100 Subject: [PATCH 08/38] fix makeRelease.sh komodify release script for darwin arch --- makeReleaseMac.sh | 42 +++++++++++++++--------------------------- 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a/makeReleaseMac.sh b/makeReleaseMac.sh index 2ecf271cc..e20df75aa 100755 --- a/makeReleaseMac.sh +++ b/makeReleaseMac.sh @@ -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 - - From dd7eb14dcf968709fbb6c0bd81a114d2ebfa9815 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 27 Nov 2018 13:13:56 -0400 Subject: [PATCH 09/38] modified: assetchains.json modified: assetchains.old --- src/assetchains.json | 1 + src/assetchains.old | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/assetchains.json b/src/assetchains.json index 44885c9d4..d6b168d7a 100644 --- a/src/assetchains.json +++ b/src/assetchains.json @@ -119,6 +119,7 @@ { "ac_name": "EQL", "ac_supply": "500000000" + "ac_ccactivate": "205000" }, { "ac_name": "ZILLA", diff --git a/src/assetchains.old b/src/assetchains.old index 29f14198c..9164ca316 100755 --- a/src/assetchains.old +++ b/src/assetchains.old @@ -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 & From 7189ec418e6605517ccb2ae06dd9e602deb4bf4d Mon Sep 17 00:00:00 2001 From: SHossain Date: Tue, 27 Nov 2018 18:58:49 +0000 Subject: [PATCH 10/38] Update assetchains.json --- src/assetchains.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assetchains.json b/src/assetchains.json index d6b168d7a..287a88c19 100644 --- a/src/assetchains.json +++ b/src/assetchains.json @@ -118,7 +118,7 @@ }, { "ac_name": "EQL", - "ac_supply": "500000000" + "ac_supply": "500000000", "ac_ccactivate": "205000" }, { From 3043dffcf58a15d7b94f822fbfc616d7f4c79e18 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sat, 1 Dec 2018 12:52:38 +0800 Subject: [PATCH 11/38] fix getblocktemplate --- src/rpc/mining.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index aed10944c..25b75c301 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -606,9 +606,10 @@ UniValue getblocktemplate(const UniValue& params, bool fHelp) return BIP22ValidationResult(state); } } - - if (strMode != "template") - throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode"); + else + { + strMode = "template"; + } bool fvNodesEmpty; { From 46a6e1db66556165c6e35f144df96ab67ae7bf51 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 30 Nov 2018 22:37:48 -1100 Subject: [PATCH 12/38] +prints --- src/cc/dice.cpp | 4 +++- src/wallet/rpcwallet.cpp | 18 +++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index 597f2cb38..631951c0d 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -1664,7 +1664,9 @@ void *dealer0_loop(void *_arg) DicePlanFunds(entropyval,entropytxid,refsbits,cp,dicepk,dealer0_fundingtxid,entropytxs,false); if ( entropytxs < DICE_MINUTXOS ) { - n = sqrt(DICE_MINUTXOS - entropytxs) + 10; + n = sqrt(DICE_MINUTXOS - entropytxs); + if ( n > 10 ) + n = 10; for (i=0; inTime+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; @@ -5215,7 +5215,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 @@ -5225,7 +5225,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; @@ -5237,8 +5237,8 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt *txtimep = kp->txtime;//(uint32_t)out.tx->nLockTime; 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"); + } else fprintf(stderr,"utxo not eligible\n"); + } else fprintf(stderr,"no tipindex\n"); if ( numkp < 10000 && array != 0 ) { free(array); @@ -5273,11 +5273,11 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt for (i=0; i Date: Fri, 30 Nov 2018 22:39:32 -1100 Subject: [PATCH 13/38] -print --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 953a24ef4..03f9c2b36 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -5238,7 +5238,7 @@ fprintf(stderr,"ht.%d validated winning [%d] -> %.8f eligible.%u test prior\n",n 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); From 15b9d33d79eecb5a95815c2f5542c3457ed584a6 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 30 Nov 2018 22:42:53 -1100 Subject: [PATCH 14/38] Fix staking < 10000 utxo --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 03f9c2b36..941a696ca 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -5151,7 +5151,7 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt 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 ) { From dcc2079714f69c554bb762fd160ff6dfa812a18b Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 30 Nov 2018 22:49:26 -1100 Subject: [PATCH 15/38] Fix _komodo_eligible --- src/wallet/rpcwallet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 941a696ca..a1eafc6e2 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -5083,7 +5083,7 @@ 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 ) @@ -5188,7 +5188,7 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt } } 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); } block_from_future_rejecttime = (uint32_t)GetAdjustedTime() + 57; for (i=winners=0; i Date: Fri, 30 Nov 2018 22:54:07 -1100 Subject: [PATCH 16/38] Test --- src/wallet/rpcwallet.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index a1eafc6e2..6a195c912 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -5086,12 +5086,8 @@ arith_uint256 _komodo_eligible(struct komodo_staking *kp,arith_uint256 ratio,uin 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); } @@ -5170,19 +5166,23 @@ 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; if ( nValue < COIN || !out.fSpendable ) continue; const CScript& pk = out.tx->vout[out.i].scriptPubKey; + fprintf(stderr,"ExtractDestination\n"); if ( ExtractDestination(pk,address) != 0 ) { + fprintf(stderr,"IsMine\n"); if ( IsMine(*pwalletMain,address) == 0 ) continue; + fprintf(stderr,"GetTransaction\n"); if ( GetTransaction(out.tx->GetHash(),tx,hashBlock,true) != 0 && (pindex= komodo_getblockindex(hashBlock)) != 0 ) { + fprintf(stderr,"addutxo\n"); 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); } } From 257e996fff4bcb31606d104591b706f5fbab3f13 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 30 Nov 2018 22:59:10 -1100 Subject: [PATCH 17/38] Test --- src/wallet/rpcwallet.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 6a195c912..c227835bd 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -5059,8 +5059,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; @@ -5166,30 +5168,28 @@ 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; if ( nValue < COIN || !out.fSpendable ) continue; const CScript& pk = out.tx->vout[out.i].scriptPubKey; - fprintf(stderr,"ExtractDestination\n"); if ( ExtractDestination(pk,address) != 0 ) { - fprintf(stderr,"IsMine\n"); if ( IsMine(*pwalletMain,address) == 0 ) continue; - fprintf(stderr,"GetTransaction\n"); if ( GetTransaction(out.tx->GetHash(),tx,hashBlock,true) != 0 && (pindex= komodo_getblockindex(hashBlock)) != 0 ) { - fprintf(stderr,"addutxo\n"); 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\n",numkp); block_from_future_rejecttime = (uint32_t)GetAdjustedTime() + 57; for (i=winners=0; i Date: Fri, 30 Nov 2018 23:07:15 -1100 Subject: [PATCH 18/38] Test --- src/wallet/rpcwallet.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index c227835bd..d09c48a95 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -5059,10 +5059,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); + //fprintf(stderr,"realloc max.%d array.%p\n",*maxkp,array); } kp = &array[(*numkp)++]; - fprintf(stderr,"kp.%p num.%d\n",kp,*numkp); + //fprintf(stderr,"kp.%p num.%d\n",kp,*numkp); memset(kp,0,sizeof(*kp)); strcpy(kp->address,address); kp->txid = txid; @@ -5101,9 +5101,9 @@ uint32_t komodo_eligible(arith_uint256 bnTarget,arith_uint256 ratio,struct komod kp->hashval = UintToArith256(hash); segid = ((nHeight + kp->segid32) & 0x3f); hashval = _komodo_eligible(kp,ratio,blocktime,maxiters,minage,segid,nHeight,prevtime); - //for (int i=32; i>=0; i--) - // fprintf(stderr,"%02x",((uint8_t *)&hashval)[i]); - //fprintf(stderr," b.%u minage.%d segid.%d ht.%d prev.%u\n",blocktime,minage,segid,nHeight,prevtime); + for (int i=32; i>=0; i--) + fprintf(stderr,"%02x",((uint8_t *)&hashval)[i]); + fprintf(stderr," b.%u minage.%d segid.%d ht.%d prev.%u\n",blocktime,minage,segid,nHeight,prevtime); if ( hashval <= bnTarget ) { for (iter=0; iterGetHash(),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); + //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\n",numkp); +fprintf(stderr,"numkp.%d blocktime.%u\n",numkp,*blocktimep); block_from_future_rejecttime = (uint32_t)GetAdjustedTime() + 57; for (i=winners=0; i Date: Fri, 30 Nov 2018 23:11:02 -1100 Subject: [PATCH 19/38] Set blocktime for staking --- src/miner.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 8fb2b4677..981fad63f 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -463,8 +463,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; @@ -479,6 +477,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); } From 552294da4ae83cf2196f8bc3caee91b669ab671d Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 30 Nov 2018 23:13:07 -1100 Subject: [PATCH 20/38] Max to min --- src/wallet/rpcwallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index d09c48a95..31fcdc7e2 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -5146,7 +5146,7 @@ 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 || array == 0 ) From 94d569467ec78e7dd5fb05f9c4e88a0cb699d67c Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 30 Nov 2018 23:18:36 -1100 Subject: [PATCH 21/38] Test --- src/komodo_bitcoind.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 1a0fad409..0893ece6d 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1771,12 +1771,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 ) From 345a7838c289f7fccc95890ec9ed60d9fb4f947a Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 30 Nov 2018 23:23:35 -1100 Subject: [PATCH 22/38] Test --- src/komodo_bitcoind.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 0893ece6d..fd18ad0a0 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1472,14 +1472,14 @@ int32_t komodo_is_PoSblock(int32_t slowflag,int32_t height,CBlock *pblock,arith_ bnTarget = komodo_PoWtarget(&PoSperc,bnTarget,height,ASSETCHAINS_STAKED); if ( bhash < bnTarget ) { - //fprintf(stderr,"ht.%d isPoS but meets PoW diff!\n",height); +fprintf(stderr,"ht.%d isPoS but meets PoW diff!\n",height); isPoS = 0; } } } //else return(-1); } - //fprintf(stderr,"slow.%d ht.%d isPoS.%d\n",slowflag,height,isPoS); +fprintf(stderr,"slow.%d ht.%d isPoS.%d\n",slowflag,height,isPoS); return(isPoS != 0); } @@ -1824,7 +1824,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); From 803d74be34cc1ebe1cbbe540c6483273fcdfc4a1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 30 Nov 2018 23:30:26 -1100 Subject: [PATCH 23/38] Test --- src/komodo_bitcoind.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index fd18ad0a0..e7ecf5f77 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1472,14 +1472,14 @@ int32_t komodo_is_PoSblock(int32_t slowflag,int32_t height,CBlock *pblock,arith_ bnTarget = komodo_PoWtarget(&PoSperc,bnTarget,height,ASSETCHAINS_STAKED); if ( bhash < bnTarget ) { -fprintf(stderr,"ht.%d isPoS but meets PoW diff!\n",height); + //fprintf(stderr,"ht.%d isPoS but meets PoW diff!\n",height); isPoS = 0; } } } //else return(-1); } -fprintf(stderr,"slow.%d ht.%d isPoS.%d\n",slowflag,height,isPoS); + //fprintf(stderr,"slow.%d ht.%d isPoS.%d\n",slowflag,height,isPoS); return(isPoS != 0); } @@ -1796,6 +1796,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 ) { @@ -1824,7 +1826,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); From 3777611fbc459b3e1a377edcfb2fe7b476a8e76a Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 30 Nov 2018 23:34:51 -1100 Subject: [PATCH 24/38] Test --- src/wallet/rpcwallet.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 31fcdc7e2..46b8d1818 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -5189,7 +5189,7 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt 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,"numkp.%d blocktime.%u\n",numkp,*blocktimep); +//fprintf(stderr,"numkp.%d blocktime.%u\n",numkp,*blocktimep); block_from_future_rejecttime = (uint32_t)GetAdjustedTime() + 57; for (i=winners=0; inTime+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; @@ -5215,7 +5215,7 @@ fprintf(stderr,"i.%d %u vs %u\n",i,eligible2,eligible); 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 @@ -5225,7 +5225,7 @@ fprintf(stderr,"m.%d ht.%d validated winning blocktime %u -> %.8f eligible.%u te } 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; @@ -5237,7 +5237,7 @@ fprintf(stderr,"ht.%d validated winning [%d] -> %.8f eligible.%u test prior\n",n *txtimep = kp->txtime;//(uint32_t)out.tx->nLockTime; 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,"utxo not eligible\n"); } if ( numkp < 10000 && array != 0 ) { @@ -5273,11 +5273,11 @@ fprintf(stderr,"ht.%d validated winning [%d] -> %.8f eligible.%u test prior\n",n for (i=0; i Date: Fri, 30 Nov 2018 23:36:57 -1100 Subject: [PATCH 25/38] -print --- src/wallet/rpcwallet.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 46b8d1818..cbba7cca9 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -5101,9 +5101,9 @@ uint32_t komodo_eligible(arith_uint256 bnTarget,arith_uint256 ratio,struct komod kp->hashval = UintToArith256(hash); segid = ((nHeight + kp->segid32) & 0x3f); hashval = _komodo_eligible(kp,ratio,blocktime,maxiters,minage,segid,nHeight,prevtime); - for (int i=32; i>=0; i--) - fprintf(stderr,"%02x",((uint8_t *)&hashval)[i]); - fprintf(stderr," b.%u minage.%d segid.%d ht.%d prev.%u\n",blocktime,minage,segid,nHeight,prevtime); + //for (int i=32; i>=0; i--) + // fprintf(stderr,"%02x",((uint8_t *)&hashval)[i]); + //fprintf(stderr," b.%u minage.%d segid.%d ht.%d prev.%u\n",blocktime,minage,segid,nHeight,prevtime); if ( hashval <= bnTarget ) { for (iter=0; iter Date: Sat, 1 Dec 2018 01:19:33 -1100 Subject: [PATCH 26/38] Change entropy tx issuing --- src/cc/dice.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index 631951c0d..ae9e01fce 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -1652,21 +1652,28 @@ 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; CPubKey mypk,dicepk; uint64_t entropyval; uint256 entropytxid; int32_t height,lastht,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; 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; while ( 1 ) { + while ( KOMODO_INSYNC == 0 || (height= KOMODO_INSYNC) == lastht ) + { + sleep(3); + } + lastht = height; + fprintf(stderr,"New height.%d\n",height); DicePlanFunds(entropyval,entropytxid,refsbits,cp,dicepk,dealer0_fundingtxid,entropytxs,false); if ( entropytxs < DICE_MINUTXOS ) { n = sqrt(DICE_MINUTXOS - entropytxs); - if ( n > 10 ) - n = 10; + //if ( n > 10 ) + // n = 10; for (i=0; i Date: Sat, 1 Dec 2018 01:23:56 -1100 Subject: [PATCH 27/38] Limit to 10 --- src/cc/dice.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index ae9e01fce..a2909efc3 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -1672,8 +1672,8 @@ void *dealer0_loop(void *_arg) if ( entropytxs < DICE_MINUTXOS ) { n = sqrt(DICE_MINUTXOS - entropytxs); - //if ( n > 10 ) - // n = 10; + if ( n > 10 ) + n = 10; for (i=0; i Date: Sat, 1 Dec 2018 01:50:35 -1100 Subject: [PATCH 28/38] AddNormalinputs2 bypass bitcoin wallet --- src/cc/CCinclude.h | 1 + src/cc/CCtx.cpp | 89 ++++++++++++++++++++++++++++++++++++++++++++++ src/cc/dice.cpp | 2 +- 3 files changed, 91 insertions(+), 1 deletion(-) diff --git a/src/cc/CCinclude.h b/src/cc/CCinclude.h index ddfecd47a..83c85e551 100644 --- a/src/cc/CCinclude.h +++ b/src/cc/CCinclude.h @@ -178,6 +178,7 @@ std::string FinalizeCCTx(uint64_t skipmask,struct CCcontract_info *cp,CMutableTr void SetCCunspents(std::vector > &unspentOutputs,char *coinaddr); void SetCCtxids(std::vector > &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 diff --git a/src/cc/CCtx.cpp b/src/cc/CCtx.cpp index b94e1372c..b683a7f51 100644 --- a/src/cc/CCtx.cpp +++ b/src/cc/CCtx.cpp @@ -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 > 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 >::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 0 ) + { + for (i=0; itxid = 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; i0; 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); +} diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index a2909efc3..7af73241b 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -1392,7 +1392,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)); From 69f0b8631f6c028fec0768eb4c3e82a16c0d00e6 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 1 Dec 2018 01:56:08 -1100 Subject: [PATCH 29/38] Remove 10 entropy cap --- src/cc/dice.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index 7af73241b..9c8438fd4 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -1672,8 +1672,8 @@ void *dealer0_loop(void *_arg) if ( entropytxs < DICE_MINUTXOS ) { n = sqrt(DICE_MINUTXOS - entropytxs); - if ( n > 10 ) - n = 10; + //if ( n > 10 ) + // n = 10; for (i=0; i Date: Sat, 1 Dec 2018 03:16:26 -1100 Subject: [PATCH 30/38] Verify entropy tx is confirmed for dealer0 --- src/cc/dice.cpp | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index 9c8438fd4..4f923d754 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -1505,7 +1505,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() ); @@ -1652,7 +1652,7 @@ 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 height,lastht,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 entropytxid,txid; int32_t height,lastht,entropytxs,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"); @@ -1660,6 +1660,7 @@ void *dealer0_loop(void *_arg) } fprintf(stderr,"dealer0 node running\n"); height = lastht = 0; + entropytx = (CTransaction *)calloc(sizeof(*entropytx),DICE_MINUTXOS); while ( 1 ) { while ( KOMODO_INSYNC == 0 || (height= KOMODO_INSYNC) == lastht ) @@ -1674,7 +1675,7 @@ void *dealer0_loop(void *_arg) n = sqrt(DICE_MINUTXOS - entropytxs); //if ( n > 10 ) // n = 10; - for (i=0; i 64 && is_hexstr((char *)res.c_str(),0) > 64 ) @@ -1686,10 +1687,30 @@ void *dealer0_loop(void *_arg) { fprintf(stderr,"ENTROPY %s: %d of %d, %d\n",tx.GetHash().GetHex().c_str(),i,n,DICE_MINUTXOS - entropytxs); RelayTransaction(tx); + entropytxs[m++] = tx; } else break; } else break; } else break; } + for (i=0; i Date: Sat, 1 Dec 2018 03:17:26 -1100 Subject: [PATCH 31/38] numentropytxs --- src/cc/dice.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index 4f923d754..dd7ef11ab 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -1652,7 +1652,7 @@ static uint256 dealer0_fundingtxid; void *dealer0_loop(void *_arg) { char *planstr = (char *)_arg; - CTransaction tx,*entropytxs,entropytx; CPubKey mypk,dicepk; uint64_t entropyval; uint256 entropytxid,txid; int32_t height,lastht,entropytxs,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; + CTransaction tx,*entropytxs,entropytx; CPubKey mypk,dicepk; uint64_t entropyval; uint256 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"); @@ -1669,13 +1669,13 @@ void *dealer0_loop(void *_arg) } lastht = height; fprintf(stderr,"New height.%d\n",height); - DicePlanFunds(entropyval,entropytxid,refsbits,cp,dicepk,dealer0_fundingtxid,entropytxs,false); - if ( entropytxs < DICE_MINUTXOS ) + DicePlanFunds(entropyval,entropytxid,refsbits,cp,dicepk,dealer0_fundingtxid,numentropytxs,false); + if ( numentropytxs < DICE_MINUTXOS ) { - n = sqrt(DICE_MINUTXOS - entropytxs); + n = sqrt(DICE_MINUTXOS - numentropytxs); //if ( n > 10 ) // n = 10; - for (i=m=0; i 64 && is_hexstr((char *)res.c_str(),0) > 64 ) @@ -1685,7 +1685,7 @@ 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; From 760d30b22bdecc19f6cadeb49fb65ad2a030643b Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 1 Dec 2018 03:17:56 -1100 Subject: [PATCH 32/38] hashBlock --- src/cc/dice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index dd7ef11ab..3cb1a5a25 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -1652,7 +1652,7 @@ static uint256 dealer0_fundingtxid; void *dealer0_loop(void *_arg) { char *planstr = (char *)_arg; - CTransaction tx,*entropytxs,entropytx; CPubKey mypk,dicepk; uint64_t entropyval; uint256 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; + 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"); From d6dfb8c2506326a9f39b28918e792a655972fa1c Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 1 Dec 2018 03:18:45 -1100 Subject: [PATCH 33/38] numentropytxs --- src/cc/dice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index 3cb1a5a25..0676900e4 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -1660,7 +1660,7 @@ void *dealer0_loop(void *_arg) } fprintf(stderr,"dealer0 node running\n"); height = lastht = 0; - entropytx = (CTransaction *)calloc(sizeof(*entropytx),DICE_MINUTXOS); + entropytx = (CTransaction *)calloc(sizeof(*entropytxs),DICE_MINUTXOS); while ( 1 ) { while ( KOMODO_INSYNC == 0 || (height= KOMODO_INSYNC) == lastht ) From 2ee44287ade0860d1de384f40d517ecb1c95f3fd Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 1 Dec 2018 03:19:24 -1100 Subject: [PATCH 34/38] Txs --- src/cc/dice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index 0676900e4..6d09eda07 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -1660,7 +1660,7 @@ void *dealer0_loop(void *_arg) } fprintf(stderr,"dealer0 node running\n"); height = lastht = 0; - entropytx = (CTransaction *)calloc(sizeof(*entropytxs),DICE_MINUTXOS); + entropytxs = (CTransaction *)calloc(sizeof(*entropytxs),DICE_MINUTXOS); while ( 1 ) { while ( KOMODO_INSYNC == 0 || (height= KOMODO_INSYNC) == lastht ) From 4c1cab06b0bdc443855461a55fb0578c7d820a86 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 1 Dec 2018 03:32:40 -1100 Subject: [PATCH 35/38] +prints --- src/cc/dice.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index 6d09eda07..ff55be6ef 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -1696,7 +1696,7 @@ void *dealer0_loop(void *_arg) { tx = entropytxs[i]; txid = tx.GetHash(); - fprintf(stderr,"found %d of %d: %s\n",i,m,txid.GetHex().c_str()); + fprintf(stderr,"check %d of %d: %s\n",i,m,txid.GetHex().c_str()); while ( 1 ) { if ( myGetTransaction(txid,entropytx,hashBlock) == 0 || hashBlock == zeroid ) @@ -1708,7 +1708,12 @@ void *dealer0_loop(void *_arg) RelayTransaction(tx); } sleep(10); - } else break; + } + else + { + fprintf(stderr,"found %s in %s\n",txid.GetHex().c_str(),hashBlock.GetHex().c_str()); + break; + } } } } From 2e8f9eda462090ffe43949610251ed4b9891b3ec Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 1 Dec 2018 03:40:13 -1100 Subject: [PATCH 36/38] Test --- src/cc/dice.cpp | 2 +- src/main.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index ff55be6ef..0581dc9ce 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -1707,13 +1707,13 @@ void *dealer0_loop(void *_arg) fprintf(stderr,"resend ENTROPY %s: %d of %d\n",txid.GetHex().c_str(),i,m); RelayTransaction(tx); } - sleep(10); } else { fprintf(stderr,"found %s in %s\n",txid.GetHex().c_str(),hashBlock.GetHex().c_str()); break; } + sleep(10); } } } diff --git a/src/main.cpp b/src/main.cpp index de9fe34c3..564221f17 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1979,6 +1979,7 @@ bool myAddtomempool(CTransaction &tx, CValidationState *pstate) bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock) { + hashBlock = zeroid; // need a GetTransaction without lock so the validation code for assets can run without deadlock { //fprintf(stderr,"check mempool\n"); @@ -2022,6 +2023,7 @@ bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlo bool GetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock, bool fAllowSlow) { CBlockIndex *pindexSlow = NULL; + hashBlock = zeroid; LOCK(cs_main); From e5a4fcc4b82e8160f9671e38a0622958e0338e29 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 1 Dec 2018 03:42:33 -1100 Subject: [PATCH 37/38] memset(&hashBlock,0,sizeof(hashBlock)); --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 564221f17..942dc120e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1979,7 +1979,7 @@ bool myAddtomempool(CTransaction &tx, CValidationState *pstate) bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock) { - hashBlock = zeroid; + 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"); @@ -2023,7 +2023,7 @@ bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlo bool GetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock, bool fAllowSlow) { CBlockIndex *pindexSlow = NULL; - hashBlock = zeroid; + memset(&hashBlock,0,sizeof(hashBlock)); LOCK(cs_main); From b0b80e69e68069da8d55537cc1856c83eeeff921 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 1 Dec 2018 03:59:11 -1100 Subject: [PATCH 38/38] Entropy tx size 1.0 --- src/cc/dice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index 0581dc9ce..6faaa1f0c 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -1677,7 +1677,7 @@ void *dealer0_loop(void *_arg) // n = 10; for (i=m=0; i 64 && is_hexstr((char *)res.c_str(),0) > 64 ) { if ( DecodeHexTx(tx,res) != 0 )