From eeaec53966634f55a44ec48ad08cb9691d8bb499 Mon Sep 17 00:00:00 2001 From: ca333 Date: Tue, 31 Oct 2017 01:43:52 +0100 Subject: [PATCH 01/49] update travis config --- .travis.yml | 94 +++++++++++++---------------------------------------- 1 file changed, 22 insertions(+), 72 deletions(-) diff --git a/.travis.yml b/.travis.yml index 662ac5681..250756396 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,73 +1,23 @@ -# errata: -# - A travis bug causes caches to trample eachother when using the same -# compiler key (which we don't use anyway). This is worked around for now by -# replacing the "compilers" with a build name prefixed by the no-op ":" -# command. See: https://github.com/travis-ci/casher/issues/6 - -os: linux language: cpp -compiler: gcc -env: - global: - - MAKEJOBS=-j3 - - RUN_TESTS=false - - BOOST_TEST_RANDOM=1$TRAVIS_BUILD_ID - - CCACHE_SIZE=100M - - CCACHE_TEMPDIR=/tmp/.ccache-temp - - CCACHE_COMPRESS=1 - - BASE_OUTDIR=$TRAVIS_BUILD_DIR/out - - SDK_URL=https://bitcoincore.org/depends-sources/sdks - - PYTHON_DEBUG=1 - - WINEDEBUG=fixme-all -cache: - apt: true - directories: - - depends/built - - depends/sdk-sources - - $HOME/.ccache -matrix: - fast_finish: true - include: - - compiler: ": ARM" - env: HOST=arm-linux-gnueabihf PACKAGES="g++-arm-linux-gnueabihf" DEP_OPTS="NO_QT=1" GOAL="install" BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports" - - compiler: ": Win32" - env: HOST=i686-w64-mingw32 PACKAGES="nsis gcc-mingw-w64-i686 g++-mingw-w64-i686 binutils-mingw-w64-i686 mingw-w64-dev wine bc" RUN_TESTS=true GOAL="deploy" BITCOIN_CONFIG="--enable-reduce-exports" MAKEJOBS="-j2" - - compiler: ": 32-bit + dash" - env: HOST=i686-pc-linux-gnu PACKAGES="g++-multilib bc python-zmq" PPA="ppa:chris-lea/zeromq" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-zmq --enable-glibc-back-compat --enable-reduce-exports LDFLAGS=-static-libstdc++" USE_SHELL="/bin/dash" - - compiler: ": Win64" - env: HOST=x86_64-w64-mingw32 PACKAGES="nsis gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 binutils-mingw-w64-x86-64 mingw-w64-dev wine bc" RUN_TESTS=true GOAL="deploy" BITCOIN_CONFIG="--enable-reduce-exports" MAKEJOBS="-j2" - - compiler: ": bitcoind" - env: HOST=x86_64-unknown-linux-gnu PACKAGES="bc python-zmq" PPA="ppa:chris-lea/zeromq" DEP_OPTS="NO_QT=1 NO_UPNP=1 DEBUG=1" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-zmq --enable-glibc-back-compat --enable-reduce-exports CPPFLAGS=-DDEBUG_LOCKORDER" - - compiler: ": No wallet" - env: HOST=x86_64-unknown-linux-gnu DEP_OPTS="NO_WALLET=1" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports" - - compiler: ": Cross-Mac" - env: HOST=x86_64-apple-darwin11 PACKAGES="cmake libcap-dev libz-dev libbz2-dev" BITCOIN_CONFIG="--enable-reduce-exports" OSX_SDK=10.9 GOAL="deploy" - exclude: - - compiler: gcc -install: - - if [ -n "$PACKAGES" ]; then sudo rm -f /etc/apt/sources.list.d/travis_ci_zeromq3-source.list; fi - - if [ -n "$PACKAGES" ]; then travis_retry sudo apt-get update; fi - - if [ -n "$PACKAGES" ]; then travis_retry sudo apt-get install --no-install-recommends --no-upgrade -qq $PACKAGES; fi -before_script: - - unset CC; unset CXX - - mkdir -p depends/SDKs depends/sdk-sources - - if [ -n "$OSX_SDK" -a ! -f depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz ]; then wget $SDK_URL/MacOSX${OSX_SDK}.sdk.tar.gz -O depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz; fi - - if [ -n "$OSX_SDK" -a -f depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz ]; then tar -C depends/SDKs -xf depends/sdk-sources/MacOSX${OSX_SDK}.sdk.tar.gz; fi - - make $MAKEJOBS -C depends HOST=$HOST $DEP_OPTS -script: - - if [ -n "$USE_SHELL" ]; then export CONFIG_SHELL="$USE_SHELL"; fi - - OUTDIR=$BASE_OUTDIR/$TRAVIS_PULL_REQUEST/$TRAVIS_JOB_NUMBER-$HOST - - BITCOIN_CONFIG_ALL="--disable-dependency-tracking --prefix=$TRAVIS_BUILD_DIR/depends/$HOST --bindir=$OUTDIR/bin --libdir=$OUTDIR/lib" - - depends/$HOST/native/bin/ccache --max-size=$CCACHE_SIZE - - if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then export CCACHE_READONLY=1; fi - - test -n "$USE_SHELL" && eval '"$USE_SHELL" -c "./autogen.sh"' || ./autogen.sh - - ./configure --cache-file=config.cache $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG || ( cat config.log && false) - - make distdir PACKAGE=bitcoin VERSION=$HOST - - cd bitcoin-$HOST - - ./configure --cache-file=../config.cache $BITCOIN_CONFIG_ALL $BITCOIN_CONFIG || ( cat config.log && false) - - make $MAKEJOBS $GOAL || ( echo "Build failure. Verbose build follows." && make $GOAL V=1 ; false ) - - export LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/depends/$HOST/lib - - if [ "$RUN_TESTS" = "true" ]; then make check; fi - - if [ "$RUN_TESTS" = "true" ]; then qa/pull-tester/rpc-tests.sh; fi -after_script: - - if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then (echo "Upload goes here. Something like: scp -r $BASE_OUTDIR server" || echo "upload failed"); fi + +compiler: + - gcc + +before_install: + - sudo add-apt-repository --yes ppa:ubuntu-sdk-team/ppa + - sudo apt-get update -qq + - sudo apt-get install build-essential pkg-config libcurl3-gnutls-dev libc6-dev libevent-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libssl-dev libprotobuf-dev protobuf-compiler libdb++-dev ntp ntpdate +#install: + +script: + - ./zcutil/build.sh -j 5 + +notifications: + irc: + channels: + - "chat.freenode.net#komodoplatform" + template: + - "%{repository}/%{branch} (%{commit} - %{author}): %{message}" + - "Alt Message : %{repository_slug} - (%{commit} - %{author}): %{message}, Build Time: %{duration}" + - "Change view : %{compare_url}" + - "Build details : %{build_url}" From 4ea19a87a1b73ca9e0612878282d25c3afa823c7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 30 Nov 2017 23:42:15 +0400 Subject: [PATCH 02/49] Test --- src/wallet/wallet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 67f7a7fe0..341b2bf5a 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2749,7 +2749,7 @@ bool CWallet::CreateTransaction(const vector& vecSend, CWalletTx& wt //interest = 0; // interest2 also //} CAmount nChange = (nValueIn - nValue + interest2); -fprintf(stderr,"wallet change %.8f (%.8f - %.8f) interest2 %.8f total %.8f\n",(double)nChange/COIN,(double)nValueIn/COIN,(double)nValue/COIN,(double)interest2/COIN,(double)nTotalValue/COIN); +//fprintf(stderr,"wallet change %.8f (%.8f - %.8f) interest2 %.8f total %.8f\n",(double)nChange/COIN,(double)nValueIn/COIN,(double)nValue/COIN,(double)interest2/COIN,(double)nTotalValue/COIN); if (nSubtractFeeFromAmount == 0) nChange -= nFeeRet; From 8bec736c1ffc5a268c8a8e1e03b00802a68f39a6 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 1 Jan 2018 15:36:45 +0700 Subject: [PATCH 03/49] AXO, ETOMIC, BTCH --- src/assetchains | 3 +++ src/assetchains.old | 4 ++++ src/dpowassets | 3 +++ src/fiat-cli | 3 +++ src/fiat/axo | 2 ++ src/fiat/btch | 2 ++ src/fiat/etomic | 2 ++ 7 files changed, 19 insertions(+) create mode 100755 src/fiat/axo create mode 100755 src/fiat/btch create mode 100755 src/fiat/etomic diff --git a/src/assetchains b/src/assetchains index 6b80a62ea..0d3773eec 100755 --- a/src/assetchains +++ b/src/assetchains @@ -46,6 +46,9 @@ komodo_asset KV 1000000 komodo_asset CEAL 366666666 komodo_asset MESH 1000007 komodo_asset MNZ 257142858 +komodo_asset AXO 200000000 +komodo_asset ETOMIC 100000000 +komodo_asset BTCH 20998641 komodo_asset USD komodo_asset EUR diff --git a/src/assetchains.old b/src/assetchains.old index 601eda111..c92d4cf1a 100755 --- a/src/assetchains.old +++ b/src/assetchains.old @@ -23,6 +23,10 @@ echo $pubkey ./komodod -pubkey=$pubkey -ac_name=CEAL -ac_supply=366666666 -addnode=78.47.196.146 $1 & ./komodod -pubkey=$pubkey -ac_name=MESH -ac_supply=1000007 -addnode=78.47.196.146 $1 & ./komodod -pubkey=$pubkey -ac_name=MNZ -ac_supply=257142858 -addnode=51.15.138.138 $1 & +./komodod -pubkey=$pubkey -ac_name=AXO -ac_supply=200000000 -addnode=78.47.196.146 & +./komodod -pubkey=$pubkey -ac_name=ETOMIC -ac_supply=100000000 -addnode=78.47.196.146 & +./komodod -pubkey=$pubkey -ac_name=BTCH -ac_supply=20998641 -addnode=78.47.196.146 & + sleep $delay ./komodod -pubkey=$pubkey -ac_name=USD -addnode=78.47.196.146 $1 & diff --git a/src/dpowassets b/src/dpowassets index 6c1c75c2c..b047eeae2 100755 --- a/src/dpowassets +++ b/src/dpowassets @@ -25,6 +25,9 @@ curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dp curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MESH\",\"pubkey\":\"$pubkey\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MNZ\",\"pubkey\":\"$pubkey\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CHIPS\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"AXO\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"ETOMIC\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BTCH\",\"pubkey\":\"$pubkey\"}" #curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"USD\",\"pubkey\":\"$pubkey\"}" diff --git a/src/fiat-cli b/src/fiat-cli index 5c8940f82..f38ea57a0 100755 --- a/src/fiat-cli +++ b/src/fiat-cli @@ -51,3 +51,6 @@ echo kv; fiat/kv $1 $2 $3 $4 echo ceal; fiat/ceal $1 $2 $3 $4 echo mesh; fiat/mesh $1 $2 $3 $4 echo mnz; fiat/mnz $1 $2 $3 $4 +echo mnz; fiat/axo $1 $2 $3 $4 +echo mnz; fiat/etomic $1 $2 $3 $4 +echo mnz; fiat/btch $1 $2 $3 $4 diff --git a/src/fiat/axo b/src/fiat/axo new file mode 100755 index 000000000..18d38cac0 --- /dev/null +++ b/src/fiat/axo @@ -0,0 +1,2 @@ +#!/bin/bash +./komodo-cli -ac_name=AXO $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/btch b/src/fiat/btch new file mode 100755 index 000000000..6a57ea8d1 --- /dev/null +++ b/src/fiat/btch @@ -0,0 +1,2 @@ +#!/bin/bash +./komodo-cli -ac_name=BTCH $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/etomic b/src/fiat/etomic new file mode 100755 index 000000000..76eb0191c --- /dev/null +++ b/src/fiat/etomic @@ -0,0 +1,2 @@ +#!/bin/bash +./komodo-cli -ac_name=ETOMIC $1 $2 $3 $4 $5 $6 From cb84dc08eeee2638a8985eeed68b1dda13321123 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 1 Jan 2018 15:38:26 +0700 Subject: [PATCH 04/49] Fix --- src/fiat-cli | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fiat-cli b/src/fiat-cli index f38ea57a0..59753d0ed 100755 --- a/src/fiat-cli +++ b/src/fiat-cli @@ -51,6 +51,6 @@ echo kv; fiat/kv $1 $2 $3 $4 echo ceal; fiat/ceal $1 $2 $3 $4 echo mesh; fiat/mesh $1 $2 $3 $4 echo mnz; fiat/mnz $1 $2 $3 $4 -echo mnz; fiat/axo $1 $2 $3 $4 -echo mnz; fiat/etomic $1 $2 $3 $4 -echo mnz; fiat/btch $1 $2 $3 $4 +echo axo; fiat/axo $1 $2 $3 $4 +echo etomic; fiat/etomic $1 $2 $3 $4 +echo btch; fiat/btch $1 $2 $3 $4 From dfd450dff9a95cdfc8e7e9df018d875b68ed4760 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 2 Jan 2018 13:23:58 +0700 Subject: [PATCH 05/49] signedmasks for asset chains --- src/komodo.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index e8ab6d6be..d5856f119 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -546,22 +546,22 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr len += 4; if ( ASSETCHAINS_SYMBOL[0] != 0 ) printf("[%s] ht.%d NOTARIZED.%d %s.%s %sTXID.%s lens.(%d %d)\n",ASSETCHAINS_SYMBOL,height,*notarizedheightp,ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,kmdtxid.ToString().c_str(),ASSETCHAINS_SYMBOL[0]==0?"BTC":"KMD",desttxid.ToString().c_str(),opretlen,len); + if ( signedfp == 0 ) + { + char fname[512]; + komodo_statefname(fname,ASSETCHAINS_SYMBOL,(char *)"signedmasks"); + if ( (signedfp= fopen(fname,"rb+")) == 0 ) + signedfp = fopen(fname,"wb"); + else fseek(signedfp,0,SEEK_END); + } + if ( signedfp != 0 ) + { + fwrite(&height,1,sizeof(height),signedfp); + fwrite(&signedmask,1,sizeof(signedmask),signedfp); + fflush(signedfp); + } if ( ASSETCHAINS_SYMBOL[0] == 0 ) { - if ( signedfp == 0 ) - { - char fname[512]; - komodo_statefname(fname,(char *)"",(char *)"signedmasks"); - if ( (signedfp= fopen(fname,"rb+")) == 0 ) - signedfp = fopen(fname,"wb"); - else fseek(signedfp,0,SEEK_END); - } - if ( signedfp != 0 ) - { - fwrite(&height,1,sizeof(height),signedfp); - fwrite(&signedmask,1,sizeof(signedmask),signedfp); - fflush(signedfp); - } if ( opretlen > len && scriptbuf[len] == 'A' ) { //for (i=0; i Date: Tue, 2 Jan 2018 14:22:50 +0700 Subject: [PATCH 06/49] Test --- src/komodo.h | 47 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 15 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index d5856f119..74d1c5cdd 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -546,22 +546,22 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr len += 4; if ( ASSETCHAINS_SYMBOL[0] != 0 ) printf("[%s] ht.%d NOTARIZED.%d %s.%s %sTXID.%s lens.(%d %d)\n",ASSETCHAINS_SYMBOL,height,*notarizedheightp,ASSETCHAINS_SYMBOL[0]==0?"KMD":ASSETCHAINS_SYMBOL,kmdtxid.ToString().c_str(),ASSETCHAINS_SYMBOL[0]==0?"BTC":"KMD",desttxid.ToString().c_str(),opretlen,len); - if ( signedfp == 0 ) - { - char fname[512]; - komodo_statefname(fname,ASSETCHAINS_SYMBOL,(char *)"signedmasks"); - if ( (signedfp= fopen(fname,"rb+")) == 0 ) - signedfp = fopen(fname,"wb"); - else fseek(signedfp,0,SEEK_END); - } - if ( signedfp != 0 ) - { - fwrite(&height,1,sizeof(height),signedfp); - fwrite(&signedmask,1,sizeof(signedmask),signedfp); - fflush(signedfp); - } if ( ASSETCHAINS_SYMBOL[0] == 0 ) { + if ( signedfp == 0 ) + { + char fname[512]; + komodo_statefname(fname,ASSETCHAINS_SYMBOL,(char *)"signedmasks"); + if ( (signedfp= fopen(fname,"rb+")) == 0 ) + signedfp = fopen(fname,"wb"); + else fseek(signedfp,0,SEEK_END); + } + if ( signedfp != 0 ) + { + fwrite(&height,1,sizeof(height),signedfp); + fwrite(&signedmask,1,sizeof(signedmask),signedfp); + fflush(signedfp); + } if ( opretlen > len && scriptbuf[len] == 'A' ) { //for (i=0; i= KOMODO_MINRATIFY && ASSETCHAINS_SYMBOL[0] != 0) || numvalid > (numnotaries/5)) ) { - if ( height > 500000 || ASSETCHAINS_SYMBOL[0] != 0 ) + if ( ASSETCHAINS_SYMBOL[0] != 0 ) + { + static FILE *signedfp; + if ( signedfp == 0 ) + { + char fname[512]; + komodo_statefname(fname,ASSETCHAINS_SYMBOL,(char *)"signedmasks"); + if ( (signedfp= fopen(fname,"rb+")) == 0 ) + signedfp = fopen(fname,"wb"); + else fseek(signedfp,0,SEEK_END); + } + if ( signedfp != 0 ) + { + fwrite(&height,1,sizeof(height),signedfp); + fwrite(&signedmask,1,sizeof(signedmask),signedfp); + fflush(signedfp); + } printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts); + } notarized = 1; } if ( NOTARY_PUBKEY33[0] != 0 && ASSETCHAINS_SYMBOL[0] == 0 ) From 1132e84500f88e4ed354c7c5cb025b4d92f06c75 Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 2 Jan 2018 14:24:59 +0700 Subject: [PATCH 07/49] Test --- src/komodo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo.h b/src/komodo.h index 74d1c5cdd..c6467d957 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -709,7 +709,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) fwrite(&signedmask,1,sizeof(signedmask),signedfp); fflush(signedfp); } - printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts); + printf("[%s] ht.%d txi.%d signedmask.%llx numvins.%d numvouts.%d <<<<<<<<<<< notarized\n",ASSETCHAINS_SYMBOL,height,i,(long long)signedmask,numvins,numvouts); } notarized = 1; } From ee92f1369d7b5d8923674e7b64f51226f12ef5c9 Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 3 Jan 2018 01:06:03 +0700 Subject: [PATCH 08/49] -SHARK --- src/assetchains | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assetchains b/src/assetchains index 0d3773eec..6063ad379 100755 --- a/src/assetchains +++ b/src/assetchains @@ -35,7 +35,7 @@ komodo_asset JUMBLR 999999 komodo_asset BET 999999 komodo_asset CRYPTO 999999 komodo_asset HODL 9999999 -komodo_asset SHARK 1401 +#komodo_asset SHARK 1401 komodo_asset MSHARK 1400000 komodo_asset BOTS 999999 komodo_asset MGW 999999 From 5faab5a65a8fbbfdefc6c819c9d1f638f843e96d Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 4 Jan 2018 18:35:35 +0700 Subject: [PATCH 09/49] -SHARK --- src/assetchains.old | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assetchains.old b/src/assetchains.old index c92d4cf1a..9e14165fe 100755 --- a/src/assetchains.old +++ b/src/assetchains.old @@ -12,7 +12,7 @@ echo $pubkey ./komodod -pubkey=$pubkey -ac_name=BET -ac_supply=999999 -addnode=78.47.196.146 $1 & ./komodod -pubkey=$pubkey -ac_name=CRYPTO -ac_supply=999999 -addnode=78.47.196.146 $1 & ./komodod -pubkey=$pubkey -ac_name=HODL -ac_supply=9999999 -addnode=78.47.196.146 $1 & -./komodod -pubkey=$pubkey -ac_name=SHARK -ac_supply=1401 -addnode=78.47.196.146 $1 & +#./komodod -pubkey=$pubkey -ac_name=SHARK -ac_supply=1401 -addnode=78.47.196.146 $1 & ./komodod -pubkey=$pubkey -ac_name=MSHARK -ac_supply=1400000 -addnode=78.47.196.146 $1 & ./komodod -pubkey=$pubkey -ac_name=BOTS -ac_supply=999999 -addnode=78.47.196.146 $1 & ./komodod -pubkey=$pubkey -ac_name=MGW -ac_supply=999999 -addnode=78.47.196.146 $1 & From b91547118a609f4b022e7137bdf557d5d1c278fe Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 4 Jan 2018 18:45:07 +0700 Subject: [PATCH 10/49] -fiat -shark fiat-cli --- src/fiat-cli | 66 ++++++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/src/fiat-cli b/src/fiat-cli index 59753d0ed..0d9dc87af 100755 --- a/src/fiat-cli +++ b/src/fiat-cli @@ -1,37 +1,37 @@ #!/bin/bash #set -x -echo aud; fiat/aud $1 $2 $3 $4 -echo bgn; fiat/bgn $1 $2 $3 $4 -echo cad; fiat/cad $1 $2 $3 $4 -echo chf; fiat/chf $1 $2 $3 $4 -echo cny; fiat/cny $1 $2 $3 $4 -echo czk; fiat/czk $1 $2 $3 $4 -echo dkk; fiat/dkk $1 $2 $3 $4 -echo eur; fiat/eur $1 $2 $3 $4 -echo gbp; fiat/gbp $1 $2 $3 $4 -echo hkd; fiat/hkd $1 $2 $3 $4 -echo hrk; fiat/hrk $1 $2 $3 $4 -echo huf; fiat/huf $1 $2 $3 $4 -echo idr; fiat/idr $1 $2 $3 $4 -echo ils; fiat/ils $1 $2 $3 $4 -echo inr; fiat/inr $1 $2 $3 $4 -echo jpy; fiat/jpy $1 $2 $3 $4 -echo krw; fiat/krw $1 $2 $3 $4 -echo mxn; fiat/mxn $1 $2 $3 $4 -echo myr; fiat/myr $1 $2 $3 $4 -echo nok; fiat/nok $1 $2 $3 $4 -echo nzd; fiat/nzd $1 $2 $3 $4 -echo php; fiat/php $1 $2 $3 $4 -echo pln; fiat/pln $1 $2 $3 $4 -echo brl; fiat/brl $1 $2 $3 $4 -echo ron; fiat/ron $1 $2 $3 $4 -echo rub; fiat/rub $1 $2 $3 $4 -echo sek; fiat/sek $1 $2 $3 $4 -echo sgd; fiat/sgd $1 $2 $3 $4 -echo thb; fiat/thb $1 $2 $3 $4 -echo try; fiat/try $1 $2 $3 $4 -echo usd; fiat/usd $1 $2 $3 $4 -echo zar; fiat/zar $1 $2 $3 $4 +#echo aud; fiat/aud $1 $2 $3 $4 +#echo bgn; fiat/bgn $1 $2 $3 $4 +#echo cad; fiat/cad $1 $2 $3 $4 +#echo chf; fiat/chf $1 $2 $3 $4 +#echo cny; fiat/cny $1 $2 $3 $4 +#echo czk; fiat/czk $1 $2 $3 $4 +#echo dkk; fiat/dkk $1 $2 $3 $4 +#echo eur; fiat/eur $1 $2 $3 $4 +#echo gbp; fiat/gbp $1 $2 $3 $4 +#echo hkd; fiat/hkd $1 $2 $3 $4 +#echo hrk; fiat/hrk $1 $2 $3 $4 +#echo huf; fiat/huf $1 $2 $3 $4 +#echo idr; fiat/idr $1 $2 $3 $4 +#echo ils; fiat/ils $1 $2 $3 $4 +#echo inr; fiat/inr $1 $2 $3 $4 +#echo jpy; fiat/jpy $1 $2 $3 $4 +#echo krw; fiat/krw $1 $2 $3 $4 +#echo mxn; fiat/mxn $1 $2 $3 $4 +#echo myr; fiat/myr $1 $2 $3 $4 +#echo nok; fiat/nok $1 $2 $3 $4 +#echo nzd; fiat/nzd $1 $2 $3 $4 +#echo php; fiat/php $1 $2 $3 $4 +#echo pln; fiat/pln $1 $2 $3 $4 +#echo brl; fiat/brl $1 $2 $3 $4 +#echo ron; fiat/ron $1 $2 $3 $4 +#echo rub; fiat/rub $1 $2 $3 $4 +#echo sek; fiat/sek $1 $2 $3 $4 +#echo sgd; fiat/sgd $1 $2 $3 $4 +#echo thb; fiat/thb $1 $2 $3 $4 +#echo try; fiat/try $1 $2 $3 $4 +#echo usd; fiat/usd $1 $2 $3 $4 +#echo zar; fiat/zar $1 $2 $3 $4 echo revs; fiat/revs $1 $2 $3 $4 echo supernet; fiat/supernet $1 $2 $3 $4 echo dex; fiat/dex $1 $2 $3 $4 @@ -40,7 +40,7 @@ echo jumblr; fiat/jumblr $1 $2 $3 $4 echo bet; fiat/bet $1 $2 $3 $4 echo crypto; fiat/crypto $1 $2 $3 $4 echo hodl; fiat/hodl $1 $2 $3 $4 -echo shark; fiat/shark $1 $2 $3 $4 +#echo shark; fiat/shark $1 $2 $3 $4 echo mshark; fiat/mshark $1 $2 $3 $4 echo bots; fiat/bots $1 $2 $3 $4 echo mgw; fiat/mgw $1 $2 $3 $4 From df473cc2775205c011cfe7f8bd5d58dc4f44afc0 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 7 Jan 2018 18:06:14 +0700 Subject: [PATCH 11/49] Check for null index in FindFork --- src/chain.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/chain.cpp b/src/chain.cpp index 5b8ce076c..9cd13d997 100644 --- a/src/chain.cpp +++ b/src/chain.cpp @@ -51,6 +51,8 @@ CBlockLocator CChain::GetLocator(const CBlockIndex *pindex) const { } const CBlockIndex *CChain::FindFork(const CBlockIndex *pindex) const { + if ( pindex == 0 ) + return(0); if (pindex->nHeight > Height()) pindex = pindex->GetAncestor(Height()); while (pindex && !Contains(pindex)) From da925f7863f69240ff0aeabe4bfb1e649691f0f1 Mon Sep 17 00:00:00 2001 From: ca333 Date: Mon, 22 Jan 2018 06:02:44 +0100 Subject: [PATCH 12/49] 333 removed unneeded dependencies --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6c927185c..65f34d3d4 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ It downloads and stores the entire history of Komodo transactions; depending on - Komodo Platform public material: [Komodo Platform public material](https://docs.google.com/document/d/1AbhWrtagu4vYdkl-vsWz-HSNyNvK-W-ZasHCqe7CZy0) ## List of Komodo Platform Technologies Delayed Proof of Work (dPoW) - Additional security layer. -zk-SNARKs - Komodo Platform�s privacy technology +zk-SNARKs - Komodo Platform's privacy technology Jumblr - Decentralized tumbler for KMD and other cryptocurrencies Assetchains - Easy way to fork Komodo coin Pegged Assets - Chains that maintain a peg to fiat currencies @@ -26,15 +26,14 @@ Block Time: 1M 2s Block Reward: 3KMD Mining Algorithm: Equihash ## About this Project -Komodo has being evolved from Zcash project, where we used some of their codebase and extended it with new technologies. -Same Zcash is based on Bitcoin's code, with differnece Zcash intends to offer a far higher standard of privacy through a sophisticated zero-knowledge proving scheme that preserves confidentiality of transaction metadata. Technical details are available in our [Protocol Specification](https://github.com/zcash/zips/raw/master/protocol/protocol.pdf). +Komodo is based on Zcash and has been by our innovative consensus algorithm called dPoW which utilizes Bitcoin's hashrate to store Komodo blockchain information into the Bitcoin blockchain. Other new and native Komodo features are the privacy technology called JUMBLR or our assetchain capabilities (one click plug and play blockchain solutions). More details are available under https://komodoplatform.com/. ## Getting started Dependencies ------------ ``` #The following packages are needed: -sudo apt-get install build-essential pkg-config libcurl3-gnutls-dev libc6-dev libevent-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python zlib1g-dev wget bsdmainutils automake libboost-all-dev libssl-dev libprotobuf-dev protobuf-compiler libqt4-dev libqrencode-dev libdb++-dev ntp ntpdate +sudo apt-get install build-essential pkg-config libc6-dev m4 g++-multilib autoconf libtool ncurses-dev unzip git python python-zmq zlib1g-dev wget libcurl3-gnutls-dev bsdmainutils automake ``` Komodo From f41277aa91f8c1c86088fbe403d4fe040cefbc5b Mon Sep 17 00:00:00 2001 From: jl777 Date: Thu, 25 Jan 2018 16:54:37 +0400 Subject: [PATCH 13/49] PIZZA and BEER --- src/fiat-cli | 2 ++ src/fiat/beer | 2 ++ src/fiat/pizza | 2 ++ 3 files changed, 6 insertions(+) create mode 100755 src/fiat/beer create mode 100755 src/fiat/pizza diff --git a/src/fiat-cli b/src/fiat-cli index 0d9dc87af..14d0f0b18 100755 --- a/src/fiat-cli +++ b/src/fiat-cli @@ -54,3 +54,5 @@ echo mnz; fiat/mnz $1 $2 $3 $4 echo axo; fiat/axo $1 $2 $3 $4 echo etomic; fiat/etomic $1 $2 $3 $4 echo btch; fiat/btch $1 $2 $3 $4 +echo pizza; fiat/pizza $1 $2 $3 $4 +echo beer; fiat/beer $1 $2 $3 $4 diff --git a/src/fiat/beer b/src/fiat/beer new file mode 100755 index 000000000..34317bb93 --- /dev/null +++ b/src/fiat/beer @@ -0,0 +1,2 @@ +#!/bin/bash +./komodo-cli -ac_name=BEER $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/pizza b/src/fiat/pizza new file mode 100755 index 000000000..d8400d9d3 --- /dev/null +++ b/src/fiat/pizza @@ -0,0 +1,2 @@ +#!/bin/bash +./komodo-cli -ac_name=PIZZA $1 $2 $3 $4 $5 $6 From b3b56273c63da546051d80b08b918b9e4141e87b Mon Sep 17 00:00:00 2001 From: Mihail Fedorov Date: Sat, 27 Jan 2018 04:46:39 +0300 Subject: [PATCH 14/49] So long and thanks for all the pax --- src/assetchains | 66 ++++++++++++++++++++++++------------------------- src/assetfunds | 34 ------------------------- 2 files changed, 33 insertions(+), 67 deletions(-) delete mode 100755 src/assetfunds diff --git a/src/assetchains b/src/assetchains index 6063ad379..784ffa28e 100755 --- a/src/assetchains +++ b/src/assetchains @@ -1,7 +1,7 @@ #!/bin/bash source pubkey.txt args=("$@") -seed_ip='78.47.196.146' +seed_ip=`getent hosts aseed.mewhub.com | awk '{ print $1 }'` komodo_binary='./komodod' delay=20 @@ -50,35 +50,35 @@ komodo_asset AXO 200000000 komodo_asset ETOMIC 100000000 komodo_asset BTCH 20998641 -komodo_asset USD -komodo_asset EUR -komodo_asset JPY -komodo_asset GBP -komodo_asset AUD -komodo_asset CAD -komodo_asset CHF -komodo_asset NZD -komodo_asset CNY -komodo_asset RUB -komodo_asset MXN -komodo_asset BRL -komodo_asset INR -komodo_asset HKD -komodo_asset TRY -komodo_asset ZAR -komodo_asset PLN -komodo_asset NOK -komodo_asset SEK -komodo_asset DKK -komodo_asset CZK -komodo_asset HUF -komodo_asset ILS -komodo_asset KRW -komodo_asset MYR -komodo_asset PHP -komodo_asset RON -komodo_asset SGD -komodo_asset THB -komodo_asset BGN -komodo_asset IDR -komodo_asset HRK +#komodo_asset USD +#komodo_asset EUR +#komodo_asset JPY +#komodo_asset GBP +#komodo_asset AUD +#komodo_asset CAD +#komodo_asset CHF +#komodo_asset NZD +#komodo_asset CNY +#komodo_asset RUB +#komodo_asset MXN +#komodo_asset BRL +#komodo_asset INR +#komodo_asset HKD +#komodo_asset TRY +#komodo_asset ZAR +#komodo_asset PLN +#komodo_asset NOK +#komodo_asset SEK +#komodo_asset DKK +#komodo_asset CZK +#komodo_asset HUF +#komodo_asset ILS +#komodo_asset KRW +#komodo_asset MYR +#komodo_asset PHP +#komodo_asset RON +#komodo_asset SGD +#komodo_asset THB +#komodo_asset BGN +#komodo_asset IDR +#komodo_asset HRK diff --git a/src/assetfunds b/src/assetfunds deleted file mode 100755 index 6aede587c..000000000 --- a/src/assetfunds +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -set -x -./komodo-cli paxdeposit $1 0.01 aud -./komodo-cli paxdeposit $1 0.01 bgn -./komodo-cli paxdeposit $1 0.01 cad -./komodo-cli paxdeposit $1 0.01 chf -./komodo-cli paxdeposit $1 0.01 cny -./komodo-cli paxdeposit $1 0.01 czk -./komodo-cli paxdeposit $1 0.01 dkk -./komodo-cli paxdeposit $1 0.01 eur -./komodo-cli paxdeposit $1 0.01 gbp -./komodo-cli paxdeposit $1 0.01 hkd -./komodo-cli paxdeposit $1 0.01 hrk -./komodo-cli paxdeposit $1 0.01 huf -./komodo-cli paxdeposit $1 0.01 idr -./komodo-cli paxdeposit $1 0.01 ils -./komodo-cli paxdeposit $1 0.01 inr -./komodo-cli paxdeposit $1 0.01 jpy -./komodo-cli paxdeposit $1 0.01 krw -./komodo-cli paxdeposit $1 0.01 mxn -./komodo-cli paxdeposit $1 0.01 myr -./komodo-cli paxdeposit $1 0.01 nok -./komodo-cli paxdeposit $1 0.01 nzd -./komodo-cli paxdeposit $1 0.01 php -./komodo-cli paxdeposit $1 0.01 pln -./komodo-cli paxdeposit $1 0.01 brl -./komodo-cli paxdeposit $1 0.01 ron -./komodo-cli paxdeposit $1 0.01 rub -./komodo-cli paxdeposit $1 0.01 sek -./komodo-cli paxdeposit $1 0.01 sgd -./komodo-cli paxdeposit $1 0.01 thb -./komodo-cli paxdeposit $1 0.01 try -./komodo-cli paxdeposit $1 0.01 usd -./komodo-cli paxdeposit $1 0.01 zar From 26e6a849ac4f2cc5a64ba070ba83bc4666ea1aa3 Mon Sep 17 00:00:00 2001 From: Mihail Fedorov Date: Sat, 27 Jan 2018 04:47:14 +0300 Subject: [PATCH 15/49] So long and thanks for all the pax --- src/assetchains | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assetchains b/src/assetchains index 784ffa28e..b05fa1507 100755 --- a/src/assetchains +++ b/src/assetchains @@ -1,7 +1,7 @@ #!/bin/bash source pubkey.txt args=("$@") -seed_ip=`getent hosts aseed.mewhub.com | awk '{ print $1 }'` +seed_ip=`getent hosts seed.mewhub.com | awk '{ print $1 }'` komodo_binary='./komodod' delay=20 From 580a1ae0cf233b5a9ecb919c51d088de67589959 Mon Sep 17 00:00:00 2001 From: Mihail Fedorov Date: Sat, 27 Jan 2018 05:14:24 +0300 Subject: [PATCH 16/49] VOTE chain --- src/assetchains | 1 + 1 file changed, 1 insertion(+) diff --git a/src/assetchains b/src/assetchains index b05fa1507..1ca93b3c2 100755 --- a/src/assetchains +++ b/src/assetchains @@ -49,6 +49,7 @@ komodo_asset MNZ 257142858 komodo_asset AXO 200000000 komodo_asset ETOMIC 100000000 komodo_asset BTCH 20998641 +komodo_asset VOTE 49999999999 #komodo_asset USD #komodo_asset EUR From b3f7ce9b7a50bb349776790ce39db7280202eedf Mon Sep 17 00:00:00 2001 From: DeckerSU Date: Sat, 27 Jan 2018 13:28:43 +0300 Subject: [PATCH 17/49] added checkpoints for KMD blockchain. need to be tested. - added method SetCheckpointData for CChainParams. - as we can't check asset it or not in CMainParams() constructor, because command line arguments don't initialized at that time, we will execute SetCheckpointData in chainparams_commandline later. changes was tested in komodo-qt wallet, but additional tests wouldn't be superfluous. --- src/chainparams.cpp | 187 ++++++++++++++++++++++++++++++++++++++++++++ src/chainparams.h | 5 +- 2 files changed, 191 insertions(+), 1 deletion(-) diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 13409c8c4..d84278b31 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -118,6 +118,7 @@ public: fRequireStandard = true; fMineBlocksOnDemand = false; fTestnetToBeDeprecatedFieldRPC = false; +/* checkpointData = (Checkpoints::CCheckpointData) { boost::assign::map_list_of @@ -131,6 +132,17 @@ public: 2777 // * estimated number of transactions per day after checkpoint // total number of tx / (checkpoint block height / (24 * 24)) }; +*/ + +// LogPrintf(">>>>>>>> ac_name = %u\n",GetArg("-ac_name","").c_str()); + +// if ( GetArg("-ac_name","").c_str()[0] != 0 ) +// { +// } +// else +// { +// } + if ( pthread_create((pthread_t *)malloc(sizeof(pthread_t)),NULL,chainparams_commandline,(void *)&consensus) != 0 ) { @@ -139,8 +151,14 @@ public: }; static CMainParams mainParams; +void CChainParams::SetCheckpointData(Checkpoints::CCheckpointData checkpointData) +{ + CChainParams::checkpointData = checkpointData; +} + void *chainparams_commandline(void *ptr) { + Checkpoints::CCheckpointData checkpointData; while ( ASSETCHAINS_PORT == 0 ) { #ifdef _WIN32 @@ -158,7 +176,176 @@ void *chainparams_commandline(void *ptr) mainParams.pchMessageStart[2] = (ASSETCHAINS_MAGIC >> 16) & 0xff; mainParams.pchMessageStart[3] = (ASSETCHAINS_MAGIC >> 24) & 0xff; fprintf(stderr,">>>>>>>>>> %s: port.%u/%u magic.%08x %u %u coins\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT,ASSETCHAINS_PORT+1,ASSETCHAINS_MAGIC,ASSETCHAINS_MAGIC,(uint32_t)ASSETCHAINS_SUPPLY); + + checkpointData = //(Checkpoints::CCheckpointData) + { + boost::assign::map_list_of + (0, mainParams.consensus.hashGenesisBlock), + //(2500, uint256S("0x0e6a3d5a46eba97c4e7618d66a39f115729e1176433c98481124c2bf733aa54e")) + //(15000, uint256S("0x00f0bd236790e903321a2d22f85bd6bf8a505f6ef4eddb20458a65d37e14d142")), + //(100000, uint256S("0x0f02eb1f3a4b89df9909fec81a4bd7d023e32e24e1f5262d9fc2cc36a715be6f")), + (int64_t)1481120910, // * UNIX timestamp of last checkpoint block + (int64_t)110415, // * total number of transactions between genesis and last checkpoint + // (the tx=... number in the SetBestChain debug.log lines) + (double)2777 // * estimated number of transactions per day after checkpoint + // total number of tx / (checkpoint block height / (24 * 24)) + }; + } + else + { + checkpointData = //(Checkpoints::CCheckpointData) + { + boost::assign::map_list_of + + (0, mainParams.consensus.hashGenesisBlock) + ( 5000, uint256S("0x049cfc91eef411e96603a42c9a77c5e30e9fe96f783ab818f4c00fb56fb29b6c")) + ( 10000, uint256S("0x0a0169db3614311cd4181deb73cfcf7f640e7dc956cda34e0121a0351925e9ae")) + ( 15000, uint256S("0x00f0bd236790e903321a2d22f85bd6bf8a505f6ef4eddb20458a65d37e14d142")) + ( 20000, uint256S("0x01bbf0c38892bdcced62b538329cf63bc7badca3e7e1bff8eb10345436871c6e")) + ( 25000, uint256S("0x04ca27808268dda8f942b647a6df844be1b263a661a13740293db962022d1f9e")) + ( 30000, uint256S("0x04c9e8cfbcd37399085e529b50147de8afb80c76c48752c122d56f23316a7acb")) + ( 35000, uint256S("0x00815f1240354cff7487c67f7dff78e248cb9053ed2c92751d1a9ad42d3eaedf")) + ( 40000, uint256S("0x00eafd9dfb1e5f1bf1cca0c49be628538900daf69b665464443d29c2c3b6a2fe")) + ( 45000, uint256S("0x0377730632caf694b92f40d03ae0fbe5bd86a1205014b71d975453ac793b0af9")) + ( 50000, uint256S("0x00076e16d3fa5194da559c17cf9cf285e21d1f13154ae4f7c7b87919549345aa")) + ( 55000, uint256S("0x0005a0701a83e05b639418ea4c87018544a4d22b2b49e5f111161e8ffc455108")) + ( 60000, uint256S("0x0000296fc15f8599b7c6561d0e0a96f24766135ed79107b603d6dd6e55142c0d")) + ( 65000, uint256S("0x000861f5d7970d5399733b4605074d47f877d6536f74ffae6f08e871ee29e6f2")) + ( 70000, uint256S("0x0002af1d487c567526c517b52996944dca344e139cddca77c2e72f746e73b263")) + ( 75000, uint256S("0x0d08129659be5f105e70c047769359eaf3475d61a726750859fdca3e1a2bf5cc")) + ( 80000, uint256S("0x0af5f3f1caae4f08c74a82689731d1ef8e55107c06f9a996e251b8ecb96989ad")) + ( 85000, uint256S("0x00000c8ee29086c5fb39eddad0619773b9ce936c77c13e5e5118a4998e939544")) + ( 90000, uint256S("0x06d3bb7f9ee5b55f67b2dc13c680699a2f736f43a44b4e4cfd41a58aa00f063f")) + ( 95000, uint256S("0x0670981b269879aae83a88f6f0c4db34763c93fd410d96435f2acb4e6580b976")) + ( 100000, uint256S("0x0f02eb1f3a4b89df9909fec81a4bd7d023e32e24e1f5262d9fc2cc36a715be6f")) + ( 105000, uint256S("0x018b97d7e6d259add24afe0e08fc125dc21d734e8831b68b430f5c3896deb4af")) + ( 110000, uint256S("0x09644ff52734e0e911a9ba7ecd03cf7995b25301840a9637891ef9af69f59c32")) + ( 115000, uint256S("0x0ee382b4729b8ceb918a92913f9c144a6a4f8a50bfc0f8b4aac5b12592caed7f")) + ( 120000, uint256S("0x082a7918a0dd9cb2df65f55acb8d0a4a535b3fa684d92c3ebcb24ed7019d975b")) + ( 125000, uint256S("0x00008f76c4484fd539c9d02fc69c40a50b6f9e00984d33890b85cc0324159e9e")) + ( 130000, uint256S("0x011b09e53acfe46f310e8c960a9c4f4f490cc7b2cd3791d7a6a80d6e8ac96b36")) + ( 135000, uint256S("0x01e0cd48358fa05646baa6f00e26717474d6049a537c8861b324d1f497dc3d4a")) + ( 140000, uint256S("0x0e6db36fd8a9d1b7baf359c8bd5c76635d0bcada973a75b5d2028ca3baea4961")) + ( 145000, uint256S("0x00010c40b57316ce6cde076807c9db956452a3c82cb09fe7d56c6bb1a7e24726")) + ( 150000, uint256S("0x0a817f15b9da636f453a7a01835cfc534ed1a55ce7f08c566471d167678bedce")) + ( 155000, uint256S("0x0528084fd00223bd9747635d7a4d8cc79f158795cad654efb78e4e4cc5f23d6a")) + ( 160000, uint256S("0x00003a09f26ae9fb7ebbfa3ef589b81ccd8909a82430f7414bc68d5a5a3316ab")) + ( 165000, uint256S("0x00004a0c6a29e7d1f22ea4e44d05e861fec5fcd8eebc5a61574c4ecf29dbb9be")) + ( 170000, uint256S("0x0cf9eac27badc0ae9a2b370dd7cc3fcb550f139349551e60978f394a2e1b262b")) + ( 175000, uint256S("0x0000137856b825d431da27ff4c3cf22f5482fa21952d45b0db0ec6774fb9b510")) + ( 180000, uint256S("0x000000b0afcccf98aa0afb6ac61050892bd9415857d66313d1f67fd1bbac312f")) + ( 185000, uint256S("0x00c2af8f88d84de080067f8ae1c25754e32e5516d20c11f85b9adae2d683687b")) + ( 190000, uint256S("0x00000033d85b3e7d19e02278ef300b8ab957d3dd3e58b4c81166ba0a58af5c3f")) + ( 195000, uint256S("0x000000964b6068be1dd4ee6893d183e86cba82a2744fb5439c463d0ba7e053b6")) + ( 200000, uint256S("0x000001763a9337328651ca57ac487cc0507087be5838fb74ca4165ff19f0e84f")) + ( 205000, uint256S("0x049fc6832e64a75ae898b32804e151e7561ea49082858c3d4af89a7de4b82f06")) + ( 210000, uint256S("0x0000000d9078b9c9604cc663eafafba8f3643bb3f3ddbb78fed4993236e1edb5")) + ( 215000, uint256S("0x00060089ecc21bcc62094e2f7f0448fe163415f6ef2f2aafe047757889ca82fe")) + ( 220000, uint256S("0x000082c78e6c2a13a9c23dd7a6faaf962fc133142b4a2d07725561f59c03bfa2")) + ( 225000, uint256S("0x00030026483167fe13505cf27049307ce42e0d9c5aa093aed10baa4f49edf4ca")) + ( 230000, uint256S("0x000183a3e17988060a35776b99c1f0b43393bbe7153b2718dfc57f428191de4e")) + ( 235000, uint256S("0x000184995f0ec024ed3783e322c8cfa5e68d9f0c77c3aaea301b22d311619156")) + ( 240000, uint256S("0x0000002cc7cf6d0a44ab57f9bd3bfa11a865bbf1cd87a2081095bc90981633a3")) + ( 245000, uint256S("0x004c5f19a88c8fe8a604006dbd2d44c94baef2a00876a17d8e2be2124003f979")) + ( 250000, uint256S("0x0dd54ef5f816c7fde9d2b1c8c1a26412b3c761cc5dd3901fa5c4cd1900892fba")) + ( 255000, uint256S("0x0b6da9e4f50c8bc7a92c539bc7474ffd6c29e0a8531f0dbbbc261fff1f990827")) + ( 260000, uint256S("0x0cac8b12bf7233ee5a68fcde9e251852b177833fefa2a9f39ec28474b0851cb9")) + ( 265000, uint256S("0x04feb5b4029f3b8b8eb3e6661a78eadd1a26b4af00ac59b5f05b261afcfd2818")) + ( 270000, uint256S("0x01bc5897bd20b8b61acf4989987ba85fbc37d9ebe848924aa8effcb08bf48fe0")) + ( 275000, uint256S("0x0416bc29eb5a12231826e546ba90fcd38aeef387ff77b45849cd418a9c1a6f12")) + ( 280000, uint256S("0x000007593e9880b171d46bce59aa0cec2a1b1f53d1fd7e8f71ccb2b9182374a4")) + ( 285000, uint256S("0x05a338b2d90cd79740221fe8635b7a834f2e486fcbb2464a4294f5a21231a5f5")) + ( 290000, uint256S("0x064ca3912cdcd833702d07a530e98bc5c6c1cd738a8825c7240b17cd68ca0cc4")) + ( 295000, uint256S("0x036b3bb318d743fd78db983a9aadd52869991d48913c4eebe2a074387d67cc5a")) + ( 300000, uint256S("0x000000fa5efd1998959926047727519ed7de06dcf9f2cd92a4f71e907e1312dc")) + ( 305000, uint256S("0x00003656231e83de2348755153ed175794696a113d7e8a15c01f90fdb7c2f287")) + ( 310000, uint256S("0x0cf6baf727eb931da0813ed8b032648c4766be79e146b0d40c643f9d8edf40f7")) + ( 315000, uint256S("0x082469974c152ebe69f1787f0d06aa5d9dd1dc69c880febde7eac2bc800146dd")) + ( 320000, uint256S("0x0000063df36b99bfb2516f55cb548a5baed1f2d8ae69c3559dc478c5c2eb32df")) + ( 325000, uint256S("0x0cb926b303a1514ba0a2f729af88ccb143517f396e9e0bde09b0736900698e0f")) + ( 330000, uint256S("0x000000be3d8bb6e31c3b534819aae7014cbbe9a44ab3e799dc1bfc724c6ab184")) + ( 335000, uint256S("0x0d0756608189fd5bbd8ec50e76180074e69e973439cc09df49134e4cb970ed4d")) + ( 340000, uint256S("0x0d814eacdb9c97003d703c0ff79b1b97b9ed8615fe12b1afaede946e5fdfe0a7")) + ( 345000, uint256S("0x000000c2910f510f1de325d300202da1a391f2719dd378173299151c3da94e85")) + ( 350000, uint256S("0x0000000228ef321323f81dae00c98d7960fc7486fb2d881007fee60d1e34653f")) + ( 355000, uint256S("0x03e6a55e382b478e0fab9c3584da3629fd9b977986a333a406b24b0d3559bf44")) + ( 360000, uint256S("0x0859c86dd718bcb5b58af06389197794e2beea6239653f2e6fa7b8a7433d29ea")) + ( 365000, uint256S("0x07896332665c707a8f55398a998e7878e8d2681ba79dd95c2859b1dafc9343d0")) + ( 370000, uint256S("0x040efd8c64cf5cf96ecf75468741a8880d1386eb5e349bef0a55116d4023944c")) + ( 375000, uint256S("0x053029e7599a09fe6c01203997d7ca738dd4c6d216a433695a0d514def1eccc0")) + ( 380000, uint256S("0x0cae44e7a421c389b88a5a204d3e39779e93aeacaab1b693741bf279fd0c8acd")) + ( 385000, uint256S("0x0b4032d2c799ba93644231ce57134dd24e13ec0dc267c1ed5912389691d2bd72")) + ( 390000, uint256S("0x0afd0f166f33a881ef289af7ea7010d58c4bbd560dee10b561c79e1b8dfd0593")) + ( 395000, uint256S("0x083774b88cf1b138d67c242d9b33c54f69d7e901b5e8144dc4a2303ab9927102")) + ( 400000, uint256S("0x036d294c5be96f4c0efb28e652eb3968231e87204a823991a85c5fdab3c43ae6")) + ( 405000, uint256S("0x0522e33bb2161fb1b33acef9a4a438fcf420dcae8a0b472e234d223d731c42b2")) + ( 410000, uint256S("0x0361d06aa807c66b87befea8119a485341d1118b694c3dbb4c3cf0b85ac69e9b")) + ( 415000, uint256S("0x072d5653d8673f64ef8b9c655f7b8021072070a072b799013ff6e96de99a59e6")) + ( 420000, uint256S("0x013b693d66955be69d4501cb1d307ca323a5c8473e25866ae7e700cdce0c654f")) + ( 425000, uint256S("0x0ef0c55af27c6971289a790dee2b2ec728fb9c6555ff9306c07f1083cf0fb4b5")) + ( 430000, uint256S("0x0ccbeeaba28291e0316a9cf54c005097c61dc67ba6f32283406d6c83b828da00")) + ( 435000, uint256S("0x020ed6b7fe1124400baba7feed463ba0c90e7e6903493fdc1a1a18c4a506055a")) + ( 440000, uint256S("0x055aaadca1908abeedc831a3f9115aa31284fc223d010590caf7b612960b61a4")) + ( 445000, uint256S("0x06d2327fa25ea7e2be742fc0e45fc4f9adb41811f21be0357f8543c5434df715")) + ( 450000, uint256S("0x0906ef1e8dc194f1f03bd4ce1ac8c6992fd721ef2c5ccbf4871ec8cdbb456c18")) + ( 455000, uint256S("0x0b8b92eec29eb20262dcf9916f0ca36d6abf0c39d321d3f480a5535cb978db71")) + ( 460000, uint256S("0x0cb04591f69a255b1127aaff3bbd59eaa21a5d9cca999de197516c251895c536")) + ( 465000, uint256S("0x029985ae78d8bb8fd170aeb3ab02ea76134ed0c19ae00211cc28a61fe5755b88")) + ( 470000, uint256S("0x01a2f4b56f37b223e75572862ad1ba956ec179332f8cd40590d7253563c86ba8")) + ( 475000, uint256S("0x0a34c6f9d4d9cb8c78c14b8041a7cc1874cfcbb22a34a5c068d1d6ff3ed9fdf0")) + ( 480000, uint256S("0x0ebab25030179996ae25969f34f6a297c7ffce1994f9b4186082a47032a9a7dc")) + ( 485000, uint256S("0x06a096e6bccf3b85537a30f95db6a414deacc0509bc84da264c2830df1a1d9b0")) + ( 490000, uint256S("0x0af828930ef13405cb536b88a3d1d4e0d84dc79ee260402c56bfa86e261c74ff")) + ( 495000, uint256S("0x09d44905bfd12849d3c2178b2ba882f8e9d6565b6e4d7a97c70a92bd6de7c5e6")) + ( 500000, uint256S("0x0bebdb417f7a51fe0c36fcf94e2ed29895a9a862eaa61601272866a7ecd6391b")) + ( 505000, uint256S("0x0c1609f4f3561baa1fc975877948af94d2107c88686a9821bc240016cc87d953")) + ( 510000, uint256S("0x0cf9a5a4997b871e615e5e398627e45fa15b3e6970ae22b47bdd11b0f5fa0fa7")) + ( 515000, uint256S("0x034171d4819e9961de13309743a32a179abede97d60ea64101dc04c97a1a0807")) + ( 520000, uint256S("0x0648fa44d5bbc2cc04a782e083c11df64ac06185f0f8e11a7416625ebb6409a6")) + ( 525000, uint256S("0x0000000ef17d63af3159e52cd351b6f000536ad88adc3a937bb747955fed58a2")) + ( 530000, uint256S("0x08e3af153995ba09e50086b64145cf4cd57db6b29f16f06f28d80d7f6121cfad")) + ( 535000, uint256S("0x02a0ffd00b51e2061b85de50a9223d9c84f4e357dc1046397bb9d7d4a827a3fb")) + ( 540000, uint256S("0x04bf07d026af29025c1ac2815e067f4a41d2872701ac9780eb3015d51cdcd854")) + ( 545000, uint256S("0x0a0d6d86635946792ad0dca57ed227a5360fc8b6d79e47132aac11e90a4963ce")) + ( 550000, uint256S("0x06df52fc5f9ba03ccc3a7673b01ab47990bd5c4947f6e1bc0ba14d21cd5bcccd")) + ( 555000, uint256S("0x0baf38eea8e08fcad3a9d760f27377e79c291b08e7fb4920cadd5cb7bab547f3")) + ( 560000, uint256S("0x00000004c34abbf1366adbae965b644c01debf15409acc715ff51cb221d92dd7")) + ( 565000, uint256S("0x067bae7119f083e0fa1820bc8e25dcfa7717e42aabaef18beefd87d974953dfb")) + ( 570000, uint256S("0x00000011a7ce7b628b7be17777d8dea2574d83f165e23c9e44aa705975820fd3")) + ( 575000, uint256S("0x0e1110a193a30d3f8d369017233a2486b11c748b3d033859a2eb7b37062d303e")) + ( 580000, uint256S("0x083cb58484aff80f48e3537e0451d49e544b3efa3da97274800c91e567d33a92")) + ( 585000, uint256S("0x0224cf835428d03472edf4f7b6fcc63b9d8d6f1d5a90ad8186bf123d541b4ea8")) + ( 590000, uint256S("0x0cfcf3b9517894e4df49db5faf8b74f3a9e01eb83c0cc5051c115d4424615dae")) + ( 595000, uint256S("0x0000000a45266983dd81e0df381a3b0455699b2f76d5b4d3f17b87d657a1b56d")) + ( 600000, uint256S("0x00000005080d5689c3b4466e551cd1986e5d2024a62a79b1335afe12c42779e4")) + ( 605000, uint256S("0x0000001c691da36848542299af859d4eb3fa408a0f425b1fbe6d622d2100623a")) + ( 610000, uint256S("0x040d8c7a0ac89e3ed8605a198583a795986aacbf18722a9897d7b925bcf757f6")) + ( 615000, uint256S("0x0449cf00fc36206389c14cbf1d762f8b96bb0440ccea5b46703e7c69b0e2bc42")) + ( 620000, uint256S("0x07227a41340c25ee1a7e9b60414259780202ffa990079fc91d8faeac9af03e60")) + ( 625000, uint256S("0x047c2472fe2afabb3d38decf24bba4ba712b60e7a1782f4afae3ede3f912f493")) + ( 630000, uint256S("0x0a7f1f04e66260cf972ab1374a9126b8abc1adaa3ab4669db5d4d4ddb9ad493d")) + ( 635000, uint256S("0x048df95165eb821dabf37ef28cf7f3be72e216e95377684253dab806985b50a4")) + ( 640000, uint256S("0x066b3c6a6a3c8dc58bef509a972c3e3ade14493b40e1b361ecbc928134e302be")) + ( 645000, uint256S("0x07d059888c9ade3bbe16d6b4d70ee9b8302d104b37a3c6cd61f81012aabd0e1e")) + ( 650000, uint256S("0x039a3cb760cc6e564974caf69e8ae621c14567f3a36e4991f77fd869294b1d52")) + ( 655000, uint256S("0x089350ee8d28b44837eb4b1fe77704953d5de2077f10c74a888d9d3ea1e13c2a")) + ( 660000, uint256S("0x000000023f8a582a61ae2f6fab6fe8197e79b7a68aaac67432421b09f1bdd4ba")) + ( 665000, uint256S("0x0b16edce865e7a0d662115774e0c0d3abbf9c69004155b693ddc933f051bfb26")) + ( 670000, uint256S("0x09070b109b089490bc372fd8358abae352d6db0e46ade6ed2200e4d4ff7aa6af")) + ( 675000, uint256S("0x08d9edeed3b6ac55991e9f32af0218ff8fa9dc808078623f4c831eb09d4f186b")) + ( 680000, uint256S("0x00000003eb2b30bfac929d3496acecab19625ac9f854a86aaf9678bea99e1cc1")) + ( 681777, uint256S("0x0000243296b9b26c040f471fdd9398ef72e57062cf05c19b9ba2fefac8165306")), + (int64_t)1516924927, // * UNIX timestamp of last checkpoint block + (int64_t)1253783, // * total number of transactions between genesis and last checkpoint + // (the tx=... number in the SetBestChain debug.log lines) + (double)2777 // * estimated number of transactions per day after checkpoint + // total number of tx / (checkpoint block height / (24 * 24)) + }; + } + + mainParams.SetCheckpointData(checkpointData); + ASSETCHAIN_INIT = 1; return(0); } diff --git a/src/chainparams.h b/src/chainparams.h index 8499d7d17..00d2c255f 100644 --- a/src/chainparams.h +++ b/src/chainparams.h @@ -87,15 +87,18 @@ public: void SetRegTestCoinbaseMustBeProtected() { consensus.fCoinbaseMustBeProtected = true; } void SetDefaultPort(uint16_t port) { nDefaultPort = port; } + void SetCheckpointData(Checkpoints::CCheckpointData checkpointData); + //void setnonce(uint32_t nonce) { memcpy(&genesis.nNonce,&nonce,sizeof(nonce)); } //void settimestamp(uint32_t timestamp) { genesis.nTime = timestamp; } //void setgenesis(CBlock &block) { genesis = block; } //void recalc_genesis(uint32_t nonce) { genesis = CreateGenesisBlock(ASSETCHAINS_TIMESTAMP, nonce, GENESIS_NBITS, 1, COIN); }; int nDefaultPort = 0; CMessageHeader::MessageStartChars pchMessageStart; // jl777 moved + Consensus::Params consensus; + protected: CChainParams() {} - Consensus::Params consensus; //! Raw pub key bytes for the broadcast alert signing key. std::vector vAlertPubKey; From 8a52db13e1de17bf109c735716f84f4e37f3c5c2 Mon Sep 17 00:00:00 2001 From: Mihail Fedorov Date: Sat, 27 Jan 2018 17:26:42 +0300 Subject: [PATCH 18/49] pax --- src/fiat-cli | 1 + src/fiat/aud | 2 -- src/fiat/bgn | 2 -- src/fiat/brl | 2 -- src/fiat/cad | 2 -- src/fiat/chf | 2 -- src/fiat/cny | 2 -- src/fiat/czk | 2 -- src/fiat/dkk | 2 -- src/fiat/eur | 2 -- src/fiat/gbp | 2 -- src/fiat/hkd | 2 -- src/fiat/hrk | 2 -- src/fiat/huf | 2 -- src/fiat/idr | 2 -- src/fiat/ils | 2 -- src/fiat/inr | 2 -- src/fiat/jpy | 2 -- src/fiat/krw | 2 -- src/fiat/mvp | 2 -- src/fiat/mxn | 2 -- src/fiat/myr | 2 -- src/fiat/nok | 2 -- src/fiat/nzd | 2 -- src/fiat/php | 2 -- src/fiat/pln | 2 -- src/fiat/ron | 2 -- src/fiat/rub | 2 -- src/fiat/sek | 2 -- src/fiat/sgd | 2 -- src/fiat/shark | 2 -- src/fiat/thb | 2 -- src/fiat/try | 2 -- src/fiat/usd | 2 -- src/fiat/zar | 2 -- 35 files changed, 1 insertion(+), 68 deletions(-) delete mode 100755 src/fiat/aud delete mode 100755 src/fiat/bgn delete mode 100755 src/fiat/brl delete mode 100755 src/fiat/cad delete mode 100755 src/fiat/chf delete mode 100755 src/fiat/cny delete mode 100755 src/fiat/czk delete mode 100755 src/fiat/dkk delete mode 100755 src/fiat/eur delete mode 100755 src/fiat/gbp delete mode 100755 src/fiat/hkd delete mode 100755 src/fiat/hrk delete mode 100755 src/fiat/huf delete mode 100755 src/fiat/idr delete mode 100755 src/fiat/ils delete mode 100755 src/fiat/inr delete mode 100755 src/fiat/jpy delete mode 100755 src/fiat/krw delete mode 100755 src/fiat/mvp delete mode 100755 src/fiat/mxn delete mode 100755 src/fiat/myr delete mode 100755 src/fiat/nok delete mode 100755 src/fiat/nzd delete mode 100755 src/fiat/php delete mode 100755 src/fiat/pln delete mode 100755 src/fiat/ron delete mode 100755 src/fiat/rub delete mode 100755 src/fiat/sek delete mode 100755 src/fiat/sgd delete mode 100755 src/fiat/shark delete mode 100755 src/fiat/thb delete mode 100755 src/fiat/try delete mode 100755 src/fiat/usd delete mode 100755 src/fiat/zar diff --git a/src/fiat-cli b/src/fiat-cli index 14d0f0b18..81ed6b56a 100755 --- a/src/fiat-cli +++ b/src/fiat-cli @@ -56,3 +56,4 @@ echo etomic; fiat/etomic $1 $2 $3 $4 echo btch; fiat/btch $1 $2 $3 $4 echo pizza; fiat/pizza $1 $2 $3 $4 echo beer; fiat/beer $1 $2 $3 $4 +echo vote; fiat/vote $1 $2 $3 $4 diff --git a/src/fiat/aud b/src/fiat/aud deleted file mode 100755 index 6fa6e2cbb..000000000 --- a/src/fiat/aud +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=AUD $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/bgn b/src/fiat/bgn deleted file mode 100755 index fdc0f5763..000000000 --- a/src/fiat/bgn +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=BGN $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/brl b/src/fiat/brl deleted file mode 100755 index b36365d99..000000000 --- a/src/fiat/brl +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=BRL $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/cad b/src/fiat/cad deleted file mode 100755 index 509150867..000000000 --- a/src/fiat/cad +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=CAD $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/chf b/src/fiat/chf deleted file mode 100755 index fbe57148c..000000000 --- a/src/fiat/chf +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=CHF $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/cny b/src/fiat/cny deleted file mode 100755 index aa4e2ca25..000000000 --- a/src/fiat/cny +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=CNY $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/czk b/src/fiat/czk deleted file mode 100755 index c0c1072d2..000000000 --- a/src/fiat/czk +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=CZK $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/dkk b/src/fiat/dkk deleted file mode 100755 index aaa6108e0..000000000 --- a/src/fiat/dkk +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=DKK $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/eur b/src/fiat/eur deleted file mode 100755 index 67de01b7d..000000000 --- a/src/fiat/eur +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=EUR $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/gbp b/src/fiat/gbp deleted file mode 100755 index eb4528f95..000000000 --- a/src/fiat/gbp +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=GBP $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/hkd b/src/fiat/hkd deleted file mode 100755 index 006ba7fe6..000000000 --- a/src/fiat/hkd +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=HKD $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/hrk b/src/fiat/hrk deleted file mode 100755 index 393b21fe3..000000000 --- a/src/fiat/hrk +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=HRK $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/huf b/src/fiat/huf deleted file mode 100755 index 55a4f7c50..000000000 --- a/src/fiat/huf +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=HUF $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/idr b/src/fiat/idr deleted file mode 100755 index 62ce7968d..000000000 --- a/src/fiat/idr +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=IDR $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/ils b/src/fiat/ils deleted file mode 100755 index de1e552b8..000000000 --- a/src/fiat/ils +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=ILS $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/inr b/src/fiat/inr deleted file mode 100755 index 10ffc9d51..000000000 --- a/src/fiat/inr +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=INR $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/jpy b/src/fiat/jpy deleted file mode 100755 index 5b8fd3768..000000000 --- a/src/fiat/jpy +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=JPY $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/krw b/src/fiat/krw deleted file mode 100755 index 7b895b1f4..000000000 --- a/src/fiat/krw +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=KRW $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/mvp b/src/fiat/mvp deleted file mode 100755 index 998d700a3..000000000 --- a/src/fiat/mvp +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=MVP $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/mxn b/src/fiat/mxn deleted file mode 100755 index d5d8d97fb..000000000 --- a/src/fiat/mxn +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=MXN $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/myr b/src/fiat/myr deleted file mode 100755 index 8c700a53c..000000000 --- a/src/fiat/myr +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=MYR $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/nok b/src/fiat/nok deleted file mode 100755 index e0e35b444..000000000 --- a/src/fiat/nok +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=NOK $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/nzd b/src/fiat/nzd deleted file mode 100755 index c9610b218..000000000 --- a/src/fiat/nzd +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=NZD $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/php b/src/fiat/php deleted file mode 100755 index c22e73293..000000000 --- a/src/fiat/php +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=PHP $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/pln b/src/fiat/pln deleted file mode 100755 index 6dfb0debb..000000000 --- a/src/fiat/pln +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=PLN $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/ron b/src/fiat/ron deleted file mode 100755 index 0b2a6effd..000000000 --- a/src/fiat/ron +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=RON $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/rub b/src/fiat/rub deleted file mode 100755 index 8d1575578..000000000 --- a/src/fiat/rub +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=RUB $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/sek b/src/fiat/sek deleted file mode 100755 index 25a14d414..000000000 --- a/src/fiat/sek +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=SEK $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/sgd b/src/fiat/sgd deleted file mode 100755 index 89a1bc5ae..000000000 --- a/src/fiat/sgd +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=SGD $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/shark b/src/fiat/shark deleted file mode 100755 index 4bda53889..000000000 --- a/src/fiat/shark +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=SHARK $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/thb b/src/fiat/thb deleted file mode 100755 index ed72913c1..000000000 --- a/src/fiat/thb +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=THB $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/try b/src/fiat/try deleted file mode 100755 index dcfa574a6..000000000 --- a/src/fiat/try +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=TRY $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/usd b/src/fiat/usd deleted file mode 100755 index 81b9e16c6..000000000 --- a/src/fiat/usd +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=USD $1 $2 $3 $4 $5 $6 diff --git a/src/fiat/zar b/src/fiat/zar deleted file mode 100755 index a3dd891c0..000000000 --- a/src/fiat/zar +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./komodo-cli -ac_name=ZAR $1 $2 $3 $4 $5 $6 From 0b7ef28990b387e42e2749cce1a68c5261819e1a Mon Sep 17 00:00:00 2001 From: ca333 Date: Sun, 28 Jan 2018 03:02:05 +0100 Subject: [PATCH 19/49] add native btch bins --- src/komodo_utils.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index ef64ad75c..1d6b7154a 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1494,12 +1494,12 @@ int32_t komodo_whoami(char *pubkeystr,int32_t height) char *argv0suffix[] = { - (char *)"mnzd", (char *)"mnz-cli", (char *)"mnzd.exe", (char *)"mnz-cli.exe" + (char *)"mnzd", (char *)"mnz-cli", (char *)"mnzd.exe", (char *)"mnz-cli.exe", (char *)"btchd", (char *)"btch-cli", (char *)"btchd.exe", (char *)"btch-cli.exe" }; char *argv0names[] = { - (char *)"MNZ", (char *)"MNZ", (char *)"MNZ", (char *)"MNZ" + (char *)"MNZ", (char *)"MNZ", (char *)"MNZ", (char *)"MNZ", (char *)"BTCH", (char *)"BTCH", (char *)"BTCH", (char *)"BTCH" }; void komodo_args(char *argv0) From f6d8f2cce9755fc9d44f3788293472b5a3cd8af1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 28 Jan 2018 19:58:35 +0400 Subject: [PATCH 20/49] rpcworkqueue=64 --- src/komodo_utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 1d6b7154a..2bc6ea1e7 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1364,7 +1364,7 @@ void komodo_configfile(char *symbol,uint16_t port) { if ( (fp= fopen(fname,"wb")) != 0 ) { - fprintf(fp,"rpcuser=user%u\nrpcpassword=pass%s\nrpcport=%u\nserver=1\ntxindex=1\n\n",crc,password,port); + fprintf(fp,"rpcuser=user%u\nrpcpassword=pass%s\nrpcport=%u\nserver=1\ntxindex=1\nrpcworkqueue=64\n",crc,password,port); fclose(fp); printf("Created (%s)\n",fname); } else printf("Couldnt create (%s)\n",fname); From 0a8ac8b037945db889fc69e9d0e0965be2b45bcb Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 29 Jan 2018 16:12:00 +0400 Subject: [PATCH 21/49] VOTE chain --- src/assetchains.old | 131 ++++++++++++++++++++++---------------------- src/fiat/vote | 2 + 2 files changed, 67 insertions(+), 66 deletions(-) create mode 100755 src/fiat/vote diff --git a/src/assetchains.old b/src/assetchains.old index 9e14165fe..7b7c3ee74 100755 --- a/src/assetchains.old +++ b/src/assetchains.old @@ -12,11 +12,9 @@ echo $pubkey ./komodod -pubkey=$pubkey -ac_name=BET -ac_supply=999999 -addnode=78.47.196.146 $1 & ./komodod -pubkey=$pubkey -ac_name=CRYPTO -ac_supply=999999 -addnode=78.47.196.146 $1 & ./komodod -pubkey=$pubkey -ac_name=HODL -ac_supply=9999999 -addnode=78.47.196.146 $1 & -#./komodod -pubkey=$pubkey -ac_name=SHARK -ac_supply=1401 -addnode=78.47.196.146 $1 & ./komodod -pubkey=$pubkey -ac_name=MSHARK -ac_supply=1400000 -addnode=78.47.196.146 $1 & ./komodod -pubkey=$pubkey -ac_name=BOTS -ac_supply=999999 -addnode=78.47.196.146 $1 & ./komodod -pubkey=$pubkey -ac_name=MGW -ac_supply=999999 -addnode=78.47.196.146 $1 & -#./komodod -pubkey=$pubkey -ac_name=MVP -ac_supply=1000000 -addnode=78.47.196.146 $1 & ./komodod -pubkey=$pubkey -ac_name=COQUI -ac_supply=72000000 -addnode=78.47.196.146 $1 & ./komodod -pubkey=$pubkey -ac_name=WLC -ac_supply=210000000 -addnode=148.251.190.89 $1 & ./komodod -pubkey=$pubkey -ac_name=KV -ac_supply=1000000 -addnode=78.47.196.146 $1 & @@ -26,69 +24,70 @@ echo $pubkey ./komodod -pubkey=$pubkey -ac_name=AXO -ac_supply=200000000 -addnode=78.47.196.146 & ./komodod -pubkey=$pubkey -ac_name=ETOMIC -ac_supply=100000000 -addnode=78.47.196.146 & ./komodod -pubkey=$pubkey -ac_name=BTCH -ac_supply=20998641 -addnode=78.47.196.146 & +./komodod -pubkey=$pubkey -ac_name=VOTE -ac_supply=49999999999 -addnode=78.47.196.146 & -sleep $delay +#sleep $delay -./komodod -pubkey=$pubkey -ac_name=USD -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=EUR -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=JPY -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=GBP -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=AUD -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=CAD -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=CHF -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=NZD -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=CNY -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=RUB -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=MXN -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=BRL -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=INR -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=HKD -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=TRY -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=ZAR -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=PLN -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=NOK -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=SEK -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=DKK -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=CZK -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=HUF -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=ILS -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=KRW -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=MYR -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=PHP -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=RON -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=SGD -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=THB -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=BGN -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=IDR -addnode=78.47.196.146 $1 & -sleep $delay -./komodod -pubkey=$pubkey -ac_name=HRK -addnode=78.47.196.146 $1 & +#./komodod -pubkey=$pubkey -ac_name=USD -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=EUR -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=JPY -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=GBP -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=AUD -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=CAD -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=CHF -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=NZD -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=CNY -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=RUB -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=MXN -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=BRL -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=INR -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=HKD -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=TRY -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=ZAR -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=PLN -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=NOK -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=SEK -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=DKK -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=CZK -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=HUF -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=ILS -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=KRW -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=MYR -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=PHP -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=RON -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=SGD -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=THB -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=BGN -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=IDR -addnode=78.47.196.146 $1 & +#sleep $delay +#./komodod -pubkey=$pubkey -ac_name=HRK -addnode=78.47.196.146 $1 & diff --git a/src/fiat/vote b/src/fiat/vote new file mode 100755 index 000000000..67f47953e --- /dev/null +++ b/src/fiat/vote @@ -0,0 +1,2 @@ +#!/bin/bash +./komodo-cli -ac_name=VOTE $1 $2 $3 $4 $5 $6 From 6fdd9555a38304f99a91b97cf346d9d5ff45a86b Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 29 Jan 2018 16:22:47 +0400 Subject: [PATCH 22/49] PIZZA and BEER, why not --- src/assetchains.old | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/assetchains.old b/src/assetchains.old index 7b7c3ee74..20f47d006 100755 --- a/src/assetchains.old +++ b/src/assetchains.old @@ -25,7 +25,8 @@ echo $pubkey ./komodod -pubkey=$pubkey -ac_name=ETOMIC -ac_supply=100000000 -addnode=78.47.196.146 & ./komodod -pubkey=$pubkey -ac_name=BTCH -ac_supply=20998641 -addnode=78.47.196.146 & ./komodod -pubkey=$pubkey -ac_name=VOTE -ac_supply=49999999999 -addnode=78.47.196.146 & - +./komodod -pubkey=$pubkey -ac_name=BEER -ac_supply=100000000 -addnode=24.54.206.138 & +./komodod -pubkey=$pubkey -ac_name=PIZZA -ac_supply=100000000 -addnode=24.54.206.138 & #sleep $delay #./komodod -pubkey=$pubkey -ac_name=USD -addnode=78.47.196.146 $1 & From 3e71f5857f508ff15e31259562f72831b43e26de Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 30 Jan 2018 17:22:45 +0400 Subject: [PATCH 23/49] Disable KV functions for KMD --- src/komodo_kv.h | 2 ++ src/wallet/rpcwallet.cpp | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/komodo_kv.h b/src/komodo_kv.h index 0d86fadd0..9aca2d387 100644 --- a/src/komodo_kv.h +++ b/src/komodo_kv.h @@ -101,6 +101,8 @@ void komodo_kvupdate(uint8_t *opretbuf,int32_t opretlen,uint64_t value) { static uint256 zeroes; uint32_t flags; uint256 pubkey,refpubkey,sig; int32_t i,refvaluesize,hassig,coresize,haspubkey,height,kvheight; uint16_t keylen,valuesize,newflag = 0; uint8_t *key,*valueptr,keyvalue[IGUANA_MAXSCRIPTSIZE]; struct komodo_kv *ptr; char *transferpubstr,*tstr; uint64_t fee; + if ( ASSETCHAINS_SYMBOL[0] == 0 ) // disable KV for KMD + return; iguana_rwnum(0,&opretbuf[1],sizeof(keylen),&keylen); iguana_rwnum(0,&opretbuf[3],sizeof(valuesize),&valuesize); iguana_rwnum(0,&opretbuf[5],sizeof(height),&height); diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index dbc3aab84..d4fab38cc 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -503,6 +503,8 @@ UniValue kvupdate(const UniValue& params, bool fHelp) throw runtime_error("kvupdate key value flags/passphrase"); if (!EnsureWalletIsAvailable(fHelp)) return 0; + if ( ASSETCHAINS_SYMBOL[0] == 0 ) + return(0); haveprivkey = 0; memset(&sig,0,sizeof(sig)); memset(&privkey,0,sizeof(privkey)); From b92d9db11b8e3315081ed9268cd2b8f4911e6204 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 2 Feb 2018 12:53:09 +0200 Subject: [PATCH 24/49] Fix typo --- 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 d4fab38cc..3a891affa 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -618,7 +618,7 @@ UniValue paxdeposit(const UniValue& params, bool fHelp) bool fSubtractFeeFromAmount = false; if ( KOMODO_PAX == 0 ) { - throw runtime_error("paxdeposit dispabled without -pax"); + throw runtime_error("paxdeposit disabled without -pax"); } if ( komodo_is_issuer() != 0 ) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "paxdeposit only from KMD"); From c83c59f97e672206b7372e51221617c5ec8984d7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 2 Feb 2018 13:19:15 +0200 Subject: [PATCH 25/49] Fix sendmany --- src/wallet/rpcwallet.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 3a891affa..d87a6a998 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1265,7 +1265,8 @@ UniValue sendmany(const UniValue& params, bool fHelp) EnsureWalletIsUnlocked(); // Check funds - CAmount nBalance = GetAccountBalance(strAccount, nMinDepth, ISMINE_SPENDABLE); + CAmount nBalance = ValueFromAmount(pwalletMain->GetBalance()); + //CAmount nBalance = GetAccountBalance(strAccount, nMinDepth, ISMINE_SPENDABLE); if (totalAmount > nBalance) throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Account has insufficient funds"); From 170d7b7ac9896a01b0a4e372c470e72397d3f385 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 2 Feb 2018 13:30:47 +0200 Subject: [PATCH 26/49] Test --- 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 d87a6a998..930f61c09 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1265,7 +1265,7 @@ UniValue sendmany(const UniValue& params, bool fHelp) EnsureWalletIsUnlocked(); // Check funds - CAmount nBalance = ValueFromAmount(pwalletMain->GetBalance()); + CAmount nBalance = pwalletMain->GetBalance(); //CAmount nBalance = GetAccountBalance(strAccount, nMinDepth, ISMINE_SPENDABLE); if (totalAmount > nBalance) throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Account has insufficient funds"); From d1f29a9d00d420bdc62398bf5b22137d1c0b2e7a Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 2 Feb 2018 13:36:12 +0200 Subject: [PATCH 27/49] Test --- src/wallet/wallet.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 341b2bf5a..9dc96f10c 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2733,10 +2733,10 @@ bool CWallet::CreateTransaction(const vector& vecSend, CWalletTx& wt //a chance at a free transaction. //But mempool inputs might still be in the mempool, so their age stays 0 //fprintf(stderr,"nCredit %.8f interest %.8f\n",(double)nCredit/COIN,(double)pcoin.first->vout[pcoin.second].interest/COIN); - if ( KOMODO_EXCHANGEWALLET == 0 ) + if ( KOMODO_EXCHANGEWALLET == 0 && ASSETCHAINS_SYMBOL[0] == 0 ) { interest2 += pcoin.first->vout[pcoin.second].interest; - fprintf(stderr,"%.8f ",(double)pcoin.first->vout[pcoin.second].interest/COIN); + //fprintf(stderr,"%.8f ",(double)pcoin.first->vout[pcoin.second].interest/COIN); } int age = pcoin.first->GetDepthInMainChain(); if (age != 0) From 9d83c1ad0f8af3fd6d99a728c0e1b67f3c379ef4 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 2 Feb 2018 13:44:30 +0200 Subject: [PATCH 28/49] Test --- 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 930f61c09..407436a2f 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -1241,8 +1241,8 @@ UniValue sendmany(const UniValue& params, bool fHelp) if (!address.IsValid()) throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, string("Invalid Komodo address: ")+name_); - if (setAddress.count(address)) - throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+name_); + //if (setAddress.count(address)) + // throw JSONRPCError(RPC_INVALID_PARAMETER, string("Invalid parameter, duplicated address: ")+name_); setAddress.insert(address); CScript scriptPubKey = GetScriptForDestination(address.Get()); From 2d8bd77a057948f21828d9cf8b0422f19ebc67d3 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 2 Feb 2018 13:44:57 +0200 Subject: [PATCH 29/49] Test --- src/policy/fees.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/policy/fees.cpp b/src/policy/fees.cpp index d4965a9b5..dd534d803 100644 --- a/src/policy/fees.cpp +++ b/src/policy/fees.cpp @@ -61,7 +61,7 @@ unsigned int TxConfirmStats::FindBucketIndex(double val) if ( it != bucketMap.end() ) { static uint32_t counter; - if ( counter++ < 10 ) + if ( counter++ < 1 ) fprintf(stderr,"%s FindBucketIndex violation: from val %f\n",ASSETCHAINS_SYMBOL,val); } return it->second; From 8b6a0cb8beef047c7f1ffbd957202885b50ead4a Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 2 Feb 2018 20:59:09 +0200 Subject: [PATCH 30/49] Stupid accounts --- 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 407436a2f..ccf4fc34a 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -105,8 +105,8 @@ void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry) string AccountFromValue(const UniValue& value) { string strAccount = value.get_str(); - if (strAccount != "") - throw JSONRPCError(RPC_WALLET_ACCOUNTS_UNSUPPORTED, "Accounts are unsupported"); + //if (strAccount != "") + // throw JSONRPCError(RPC_WALLET_ACCOUNTS_UNSUPPORTED, "Accounts are unsupported"); return strAccount; } From de615b43f72fcc938b8dad9ff66793541821a048 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 10 Feb 2018 15:12:32 +0200 Subject: [PATCH 31/49] Disable price feed --- src/miner.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/miner.cpp b/src/miner.cpp index 5c12d0af6..d7fc3a94d 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -398,7 +398,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) txNew.vin[0].scriptSig = CScript() << nHeight << OP_0; if ( ASSETCHAINS_SYMBOL[0] == 0 ) { - int32_t i,opretlen; uint8_t opret[256],*ptr; + /*int32_t i,opretlen; uint8_t opret[256],*ptr; if ( (nHeight % 60) == 0 || komodo_gateway_deposits(&txNew,(char *)"KMD",1) == 0 ) { if ( (opretlen= komodo_pax_opreturn((int32_t)nHeight,opret,sizeof(opret))) > 0 ) // have pricefeed @@ -411,7 +411,7 @@ CBlockTemplate* CreateNewBlock(const CScript& scriptPubKeyIn) txNew.vout[1].nValue = 0; //fprintf(stderr,"opretlen.%d\n",opretlen); } //else printf("null opretlen for prices\n"); - } + }*/ } else if ( komodo_is_issuer() != 0 ) { From 8f8b5a2ac649feebdbfd3d00f3806f1aa0d5cb5a Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 10 Feb 2018 21:42:04 +0200 Subject: [PATCH 32/49] -SHARK --- src/dpowassets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dpowassets b/src/dpowassets index b047eeae2..3fe8aa1b0 100755 --- a/src/dpowassets +++ b/src/dpowassets @@ -13,11 +13,9 @@ curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dp curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BET\",\"pubkey\":\"$pubkey\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CRYPTO\",\"pubkey\":\"$pubkey\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"HODL\",\"pubkey\":\"$pubkey\"}" -curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"SHARK\",\"pubkey\":\"$pubkey\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MSHARK\",\"pubkey\":\"$pubkey\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BOTS\",\"pubkey\":\"$pubkey\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MGW\",\"pubkey\":\"$pubkey\"}" -#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"MVP\",\"pubkey\":\"$pubkey\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"COQUI\",\"pubkey\":\"$pubkey\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"WLC\",\"pubkey\":\"$pubkey\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"KV\",\"pubkey\":\"$pubkey\"}" @@ -28,6 +26,8 @@ curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dp curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"AXO\",\"pubkey\":\"$pubkey\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"ETOMIC\",\"pubkey\":\"$pubkey\"}" curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"BTCH\",\"pubkey\":\"$pubkey\"}" +#curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"CHAIN\",\"pubkey\":\"$pubkey\"}" +curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"VOTE\",\"pubkey\":\"$pubkey\"}" #curl --url "http://127.0.0.1:7776" --data "{\"agent\":\"iguana\",\"method\":\"dpow\",\"symbol\":\"USD\",\"pubkey\":\"$pubkey\"}" From 81c5ec4f3c70c7a5f8a523d81b2616a884d953e4 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 18 Feb 2018 12:45:22 +0200 Subject: [PATCH 33/49] Dukeleto's https://github.com/zcash/zcash/pull/2931 --- src/txdb.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/txdb.cpp b/src/txdb.cpp index 868d3d4cd..9a23596d9 100644 --- a/src/txdb.cpp +++ b/src/txdb.cpp @@ -302,6 +302,7 @@ bool CBlockTreeDB::LoadBlockIndexGuts() pindexNew->nUndoPos = diskindex.nUndoPos; pindexNew->hashAnchor = diskindex.hashAnchor; pindexNew->nVersion = diskindex.nVersion; + pindexNew->hashReserved = diskindex.hashReserved; pindexNew->hashMerkleRoot = diskindex.hashMerkleRoot; pindexNew->nTime = diskindex.nTime; pindexNew->nBits = diskindex.nBits; From 877865e3ef4068ade16e55484c169d470368317d Mon Sep 17 00:00:00 2001 From: jl777 Date: Wed, 21 Feb 2018 16:13:55 +0200 Subject: [PATCH 34/49] -couldnt open printout --- src/komodo_utils.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 2bc6ea1e7..6c984ca0b 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1399,7 +1399,7 @@ void komodo_configfile(char *symbol,uint16_t port) sprintf(KMDUSERPASS,"%s:%s",username,password); fclose(fp); //printf("KOMODO.(%s) -> userpass.(%s)\n",fname,KMDUSERPASS); - } else printf("couldnt open.(%s)\n",fname); + } // else printf("couldnt open.(%s)\n",fname); } uint16_t komodo_userpass(char *userpass,char *symbol) @@ -1610,7 +1610,7 @@ void komodo_args(char *argv0) sprintf(iter == 0 ? KMDUSERPASS : BTCUSERPASS,"%s:%s",username,password); fclose(fp); //printf("KOMODO.(%s) -> userpass.(%s)\n",fname,KMDUSERPASS); - } else printf("couldnt open.(%s)\n",fname); + } //else printf("couldnt open.(%s)\n",fname); if ( IS_KOMODO_NOTARY == 0 ) break; } From 5fb970e7dcc2cf666d599b8c40811261178d46b5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 13 Apr 2018 12:20:52 +0300 Subject: [PATCH 35/49] Hot fix 790833 --- src/pow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pow.cpp b/src/pow.cpp index cbee3f6a6..2bf0795a6 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -158,7 +158,7 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in flag = 1; else if ( height >= 108000 && special2 > 0 ) flag = ((height % KOMODO_ELECTION_GAP) > 64 || (height % KOMODO_ELECTION_GAP) == 0); - if ( flag != 0 ) + if ( flag != 0 || height == 790833 ) bnTarget.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow); } } From 20dfaa77f51ef809e689a6d5e955d4e4e358aee0 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Apr 2018 01:30:23 +0300 Subject: [PATCH 36/49] New notaries activate height 820000 Bugfix for 790833 bug Performance improvements If your node crashed, you should be able to just pull and rebuild and it should startup. We are not seeing the need to resync on most nodes. If you are mining, this is a must update right away --- src/init.cpp | 4 + src/komodo.h | 8 +- src/komodo_bitcoind.h | 465 +++++++++++++++++++++++++++--------------- src/komodo_globals.h | 2 +- src/komodo_notary.h | 338 +++++++++++++++++++----------- src/komodo_utils.h | 4 +- src/main.cpp | 74 +++++-- src/miner.cpp | 4 +- src/pow.cpp | 84 ++++---- src/rpcblockchain.cpp | 96 +++++---- src/rpcmisc.cpp | 4 +- 11 files changed, 680 insertions(+), 403 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index fe10401a8..79552a76f 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -62,6 +62,7 @@ using namespace std; extern void ThreadSendAlert(); +extern int32_t KOMODO_LOADINGBLOCKS; ZCJoinSplit* pzcashParams = NULL; @@ -596,6 +597,7 @@ void ThreadImport(std::vector vImportFiles) LogPrintf("Reindexing finished\n"); // To avoid ending up in a situation without genesis block, re-try initializing (no-op if reindexing worked): InitBlockIndex(); + KOMODO_LOADINGBLOCKS = 0; } // hardcoded $DATADIR/bootstrap.dat @@ -1335,6 +1337,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) strLoadError = _("Error initializing block database"); break; } + KOMODO_LOADINGBLOCKS = 0; // Check for changed -txindex state if (fTxIndex != GetBoolArg("-txindex", true)) { @@ -1389,6 +1392,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) } } } + KOMODO_LOADINGBLOCKS = 0; // As LoadBlockIndex can take several minutes, it's possible the user // requested to kill the GUI during the last operation. If so, exit. diff --git a/src/komodo.h b/src/komodo.h index c6467d957..129ea3b5f 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -473,7 +473,7 @@ void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotar } } -int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scriptbuf,int32_t scriptlen,int32_t height,uint256 txhash,int32_t i,int32_t j,uint64_t *voutmaskp,int32_t *specialtxp,int32_t *notarizedheightp,uint64_t value,int32_t notarized,uint64_t signedmask) +int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scriptbuf,int32_t scriptlen,int32_t height,uint256 txhash,int32_t i,int32_t j,uint64_t *voutmaskp,int32_t *specialtxp,int32_t *notarizedheightp,uint64_t value,int32_t notarized,uint64_t signedmask,uint32_t timestamp) { static uint256 zero; static FILE *signedfp; int32_t opretlen,nid,k,len = 0; uint256 kmdtxid,desttxid; uint8_t crypto777[33]; struct komodo_state *sp; char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; @@ -499,7 +499,7 @@ int32_t komodo_voutupdate(int32_t *isratificationp,int32_t notaryid,uint8_t *scr *specialtxp = 1; //printf(">>>>>>>> "); } - else if ( komodo_chosennotary(&nid,height,scriptbuf + 1) >= 0 ) + else if ( komodo_chosennotary(&nid,height,scriptbuf + 1,timestamp) >= 0 ) { //printf("found notary.k%d\n",k); if ( notaryid < 64 ) @@ -646,7 +646,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) return; } //fprintf(stderr,"%s connect.%d\n",ASSETCHAINS_SYMBOL,pindex->nHeight); - numnotaries = komodo_notaries(pubkeys,pindex->nHeight); + numnotaries = komodo_notaries(pubkeys,pindex->nHeight,pindex->GetBlockTime()); calc_rmd160_sha256(rmd160,pubkeys[0],33); if ( pindex->nHeight > hwmheight ) hwmheight = pindex->nHeight; @@ -741,7 +741,7 @@ void komodo_connectblock(CBlockIndex *pindex,CBlock& block) #else memcpy(scriptbuf,(uint8_t *)&block.vtx[i].vout[j].scriptPubKey[0],len); #endif - notaryid = komodo_voutupdate(&isratification,notaryid,scriptbuf,len,height,txhash,i,j,&voutmask,&specialtx,¬arizedheight,(uint64_t)block.vtx[i].vout[j].nValue,notarized,signedmask); + notaryid = komodo_voutupdate(&isratification,notaryid,scriptbuf,len,height,txhash,i,j,&voutmask,&specialtx,¬arizedheight,(uint64_t)block.vtx[i].vout[j].nValue,notarized,signedmask,(uint32_t)chainActive.Tip()->GetBlockTime()); if ( 0 && i > 0 ) { for (k=0; k> 1; decode_hex(script,len,hexstr); + if ( script[1] == 0x4c ) + { + script++; + len--; + } + else if ( script[1] == 0x4d ) + { + script += 2; + len -= 2; + } retval = komodo_verifynotarizedscript(height,script,len,NOTARIZED_HASH); } } @@ -486,54 +500,54 @@ int32_t komodo_verifynotarization(char *symbol,char *dest,int32_t height,int32_t } /*uint256 komodo_getblockhash(int32_t height) -{ - uint256 hash; char params[128],*hexstr,*jsonstr; cJSON *result; int32_t i; uint8_t revbuf[32]; - memset(&hash,0,sizeof(hash)); - sprintf(params,"[%d]",height); - if ( (jsonstr= komodo_issuemethod(KMDUSERPASS,(char *)"getblockhash",params,BITCOIND_PORT)) != 0 ) - { - if ( (result= cJSON_Parse(jsonstr)) != 0 ) - { - if ( (hexstr= jstr(result,(char *)"result")) != 0 ) - { - if ( is_hexstr(hexstr,0) == 64 ) - { - decode_hex(revbuf,32,hexstr); - for (i=0; i<32; i++) - ((uint8_t *)&hash)[i] = revbuf[31-i]; - } - } - free_json(result); - } - printf("KMD hash.%d (%s) %x\n",height,jsonstr,*(uint32_t *)&hash); - free(jsonstr); - } - return(hash); -} - -uint256 _komodo_getblockhash(int32_t height);*/ + { + uint256 hash; char params[128],*hexstr,*jsonstr; cJSON *result; int32_t i; uint8_t revbuf[32]; + memset(&hash,0,sizeof(hash)); + sprintf(params,"[%d]",height); + if ( (jsonstr= komodo_issuemethod(KMDUSERPASS,(char *)"getblockhash",params,BITCOIND_PORT)) != 0 ) + { + if ( (result= cJSON_Parse(jsonstr)) != 0 ) + { + if ( (hexstr= jstr(result,(char *)"result")) != 0 ) + { + if ( is_hexstr(hexstr,0) == 64 ) + { + decode_hex(revbuf,32,hexstr); + for (i=0; i<32; i++) + ((uint8_t *)&hash)[i] = revbuf[31-i]; + } + } + free_json(result); + } + printf("KMD hash.%d (%s) %x\n",height,jsonstr,*(uint32_t *)&hash); + free(jsonstr); + } + return(hash); + } + + uint256 _komodo_getblockhash(int32_t height);*/ uint64_t komodo_seed(int32_t height) { uint64_t seed = 0; /*if ( 0 ) // problem during init time, seeds are needed for loading blockindex, so null seeds... - { - uint256 hash,zero; CBlockIndex *pindex; - memset(&hash,0,sizeof(hash)); - memset(&zero,0,sizeof(zero)); - if ( height > 10 ) - height -= 10; - if ( ASSETCHAINS_SYMBOL[0] == 0 ) - hash = _komodo_getblockhash(height); - if ( memcmp(&hash,&zero,sizeof(hash)) == 0 ) - hash = komodo_getblockhash(height); - int32_t i; - for (i=0; i<32; i++) - printf("%02x",((uint8_t *)&hash)[i]); - printf(" seed.%d\n",height); - seed = arith_uint256(hash.GetHex()).GetLow64(); - } - else*/ + { + uint256 hash,zero; CBlockIndex *pindex; + memset(&hash,0,sizeof(hash)); + memset(&zero,0,sizeof(zero)); + if ( height > 10 ) + height -= 10; + if ( ASSETCHAINS_SYMBOL[0] == 0 ) + hash = _komodo_getblockhash(height); + if ( memcmp(&hash,&zero,sizeof(hash)) == 0 ) + hash = komodo_getblockhash(height); + int32_t i; + for (i=0; i<32; i++) + printf("%02x",((uint8_t *)&hash)[i]); + printf(" seed.%d\n",height); + seed = arith_uint256(hash.GetHex()).GetLow64(); + } + else*/ { seed = (height << 13) ^ (height << 2); seed <<= 21; @@ -543,20 +557,27 @@ uint64_t komodo_seed(int32_t height) return(seed); } -uint32_t komodo_txtime(uint256 hash) +uint32_t komodo_txtime(uint64_t *valuep,uint256 hash,int32_t n,char *destaddr) { - CTransaction tx; - uint256 hashBlock; + CTxDestination address; CTransaction tx; uint256 hashBlock; + *valuep = 0; if (!GetTransaction(hash, tx, #ifndef KOMODO_ZCASH Params().GetConsensus(), #endif hashBlock, true)) { - //printf("null GetTransaction\n"); - return(tx.nLockTime); + fprintf(stderr,"ERROR: %s/v%d locktime.%u\n",hash.ToString().c_str(),n,(uint32_t)tx.nLockTime); + return(0); } - return(0); + //fprintf(stderr,"%s/v%d locktime.%u\n",hash.ToString().c_str(),n,(uint32_t)tx.nLockTime); + if ( n < tx.vout.size() ) + { + *valuep = tx.vout[n].nValue; + if (ExtractDestination(tx.vout[n].scriptPubKey, address)) + strcpy(destaddr,CBitcoinAddress(address).ToString().c_str()); + } + return(tx.nLockTime); } void komodo_disconnect(CBlockIndex *pindex,CBlock& block) @@ -574,7 +595,7 @@ void komodo_disconnect(CBlockIndex *pindex,CBlock& block) int32_t komodo_is_notarytx(const CTransaction& tx) { - uint8_t *ptr,crypto777[33]; + uint8_t *ptr; static uint8_t crypto777[33]; if ( tx.vout.size() > 0 ) { #ifdef KOMODO_ZCASH @@ -584,7 +605,8 @@ int32_t komodo_is_notarytx(const CTransaction& tx) #endif if ( ptr != 0 ) { - decode_hex(crypto777,33,(char *)CRYPTO777_PUBSECPSTR); + if ( crypto777[0] == 0 ) + decode_hex(crypto777,33,(char *)CRYPTO777_PUBSECPSTR); if ( memcmp(ptr+1,crypto777,33) == 0 ) { //printf("found notarytx\n"); @@ -597,7 +619,14 @@ int32_t komodo_is_notarytx(const CTransaction& tx) int32_t komodo_block2height(CBlock *block) { - int32_t i,n,height = 0; uint8_t *ptr; + static uint32_t match,mismatch; + int32_t i,n,height2=-1,height = 0; uint8_t *ptr; CBlockIndex *pindex; + if ( (pindex= mapBlockIndex[block->GetHash()]) != 0 ) + { + height2 = (int32_t)pindex->nHeight; + if ( height2 >= 0 ) + return(height2); + } if ( block->vtx[0].vin.size() > 0 ) { #ifdef KOMODO_ZCASH @@ -610,7 +639,7 @@ int32_t komodo_block2height(CBlock *block) //for (i=0; i<6; i++) // printf("%02x",ptr[i]); n = ptr[0]; - for (i=0; i= 0 ) + height = height2; + } else match++; return(height); } -void komodo_block2pubkey33(uint8_t *pubkey33,CBlock& block) +void komodo_block2pubkey33(uint8_t *pubkey33,CBlock *block) { int32_t n; - memset(pubkey33,0,33); - if ( block.vtx[0].vout.size() > 0 ) + if ( KOMODO_LOADINGBLOCKS == 0 ) + memset(pubkey33,0xff,33); + else memset(pubkey33,0,33); + if ( block->vtx[0].vout.size() > 0 ) { #ifdef KOMODO_ZCASH - uint8_t *ptr = (uint8_t *)block.vtx[0].vout[0].scriptPubKey.data(); + uint8_t *ptr = (uint8_t *)block->vtx[0].vout[0].scriptPubKey.data(); #else - uint8_t *ptr = (uint8_t *)&block.vtx[0].vout[0].scriptPubKey[0]; + uint8_t *ptr = (uint8_t *)&block->vtx[0].vout[0].scriptPubKey[0]; #endif //komodo_init(0); - n = block.vtx[0].vout[0].scriptPubKey.size(); + n = block->vtx[0].vout[0].scriptPubKey.size(); if ( n == 35 ) memcpy(pubkey33,ptr+1,33); } @@ -658,6 +696,13 @@ int32_t komodo_blockload(CBlock& block,CBlockIndex *pindex) return(0); } +uint32_t komodo_chainactive_timestamp() +{ + if ( chainActive.Tip() != 0 ) + return((uint32_t)chainActive.Tip()->GetBlockTime()); + else return(0); +} + CBlockIndex *komodo_chainactive(int32_t height) { if ( chainActive.Tip() != 0 ) @@ -675,73 +720,112 @@ uint32_t komodo_heightstamp(int32_t height) CBlockIndex *ptr; if ( height > 0 && (ptr= komodo_chainactive(height)) != 0 ) return(ptr->nTime); - else fprintf(stderr,"komodo_heightstamp null ptr for block.%d\n",height); + //else fprintf(stderr,"komodo_heightstamp null ptr for block.%d\n",height); return(0); } +/*void komodo_pindex_init(CBlockIndex *pindex,int32_t height) gets data corrupted + { + int32_t i,num; uint8_t pubkeys[64][33]; CBlock block; + if ( pindex->didinit != 0 ) + return; + //printf("pindex.%d komodo_pindex_init notary.%d from height.%d\n",pindex->nHeight,pindex->notaryid,height); + if ( pindex->didinit == 0 ) + { + pindex->notaryid = -1; + if ( KOMODO_LOADINGBLOCKS == 0 ) + memset(pindex->pubkey33,0xff,33); + else memset(pindex->pubkey33,0,33); + if ( komodo_blockload(block,pindex) == 0 ) + { + komodo_block2pubkey33(pindex->pubkey33,&block); + //for (i=0; i<33; i++) + // fprintf(stderr,"%02x",pindex->pubkey33[i]); + //fprintf(stderr," set pubkey at height %d/%d\n",pindex->nHeight,height); + //if ( pindex->pubkey33[0] == 2 || pindex->pubkey33[0] == 3 ) + // pindex->didinit = (KOMODO_LOADINGBLOCKS == 0); + } // else fprintf(stderr,"error loading block at %d/%d",pindex->nHeight,height); + } + if ( pindex->didinit != 0 && pindex->nHeight >= 0 && (num= komodo_notaries(pubkeys,(int32_t)pindex->nHeight,(uint32_t)pindex->nTime)) > 0 ) + { + for (i=0; ipubkey33,33) == 0 ) + { + pindex->notaryid = i; + break; + } + } + if ( 0 && i == num ) + { + for (i=0; i<33; i++) + fprintf(stderr,"%02x",pindex->pubkey33[i]); + fprintf(stderr," unmatched pubkey at height %d/%d\n",pindex->nHeight,height); + } + } + }*/ + void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height) { - CBlock block; - //komodo_init(height); + int32_t num,i; CBlock block; memset(pubkey33,0,33); if ( pindex != 0 ) { if ( komodo_blockload(block,pindex) == 0 ) - komodo_block2pubkey33(pubkey33,block); - } - else - { - // height -> pubkey33 - //printf("extending chaintip komodo_index2pubkey33 height.%d need to get pubkey33\n",height); + komodo_block2pubkey33(pubkey33,&block); } } -void komodo_connectpindex(CBlockIndex *pindex) -{ - CBlock block; - if ( komodo_blockload(block,pindex) == 0 ) - komodo_connectblock(pindex,block); -} - -int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height); -int32_t komodo_electednotary(uint8_t *pubkey33,int32_t height); - -int8_t komodo_minerid(int32_t height,uint8_t *pubkey33) -{ - int32_t num,i; CBlockIndex *pindex; uint8_t _pubkey33[33],pubkeys[64][33]; - if ( pubkey33 == 0 && (pindex= chainActive[height]) != 0 ) - { - if ( pubkey33 == 0 ) - { - pubkey33 = _pubkey33; - komodo_index2pubkey33(pubkey33,pindex,height); - } - if ( (num= komodo_notaries(pubkeys,height)) > 0 ) - { - for (i=0; ididinit != 0 ) + { + if ( destpubkey33 != 0 ) + memcpy(destpubkey33,pindex->pubkey33,33); + return(pindex->notaryid); + } + komodo_index2pubkey33(pubkey33,pindex,height); + if ( destpubkey33 != 0 ) + memcpy(destpubkey33,pindex->pubkey33,33); + if ( pindex->didinit != 0 ) + return(pindex->notaryid); + timestamp = pindex->GetBlockTime(); + if ( (num= komodo_notaries(pubkeys,height,timestamp)) > 0 ) + { + for (i=0; i= 0 ) + if ( komodo_blockload(block,pindex) == 0 ) { - //mids[i] = *(int32_t *)pubkey33; - (*nonzpkeysp)++; - } + komodo_block2pubkey33(pubkeys[i],&block); + for (j=0; j= 0 && i > 0 && mids[i] == mids[0] ) duplicate++; } @@ -751,50 +835,90 @@ int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,int32_t *non else return(0); } -int32_t komodo_minerids(uint8_t *minerids,int32_t height,int32_t width) +int32_t komodo_minerids(uint8_t *minerids,int32_t height,int32_t width) // deprecate { - int32_t i,n=0; - for (i=0; i= 225000 ) - komodo_chosennotary(¬aryid,height,_pubkey33); - if ( height >= 34000 && notaryid >= 0 ) + int32_t i,j,notaryid=0,minerid,limit,nid; uint8_t destpubkey33[33]; + komodo_chosennotary(¬aryid,height,pubkey33,timestamp); + if ( height >= 82000 ) { - if ( height < 79693 ) - limit = 64; - else if ( height < 82000 ) - limit = 8; - else limit = 66; - for (i=1; i= 0 ) { - komodo_chosennotary(&nid,height-i,_pubkey33); - if ( nid == notaryid ) //komodo_minerid(height-i,_pubkey33) + for (i=1; i<66; i++) { - if ( (0) && notaryid > 0 ) - fprintf(stderr,"ht.%d notaryid.%d already mined -i.%d nid.%d\n",height,notaryid,i,nid); - if ( height > 225000 ) - return(-1); + if ( mids[i] == notaryid ) + { + //for (j=0; j<66; j++) + // fprintf(stderr,"%d ",mids[j]); + //fprintf(stderr,"ht.%d repeat notaryid.%d in mids[%d]\n",height,notaryid,i); + if ( height > 792000 ) + return(-1); + else break; + } } + return(1); + } else return(0); + } + else + { + if ( height >= 34000 && notaryid >= 0 ) + { + if ( height < 79693 ) + limit = 64; + else if ( height < 82000 ) + limit = 8; + else limit = 66; + for (i=1; i 225000 ) + return(-1); + } + } + //fprintf(stderr,"special notaryid.%d ht.%d limit.%d\n",notaryid,height,limit); + return(1); } - //fprintf(stderr,"special notaryid.%d ht.%d limit.%d\n",notaryid,height,limit); - return(1); } return(0); } +/*int32_t komodo_MoM(int32_t *notarized_heightp,uint256 *MoMp,uint256 *kmdtxidp,int32_t nHeight,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip) +{ + int32_t depth,notarized_ht; uint256 MoM,kmdtxid; + depth = komodo_MoMdata(¬arized_ht,&MoM,&kmdtxid,nHeight,MoMoMp,MoMoMoffsetp,MoMoMdepthp,kmdstartip,kmdendip); + memset(MoMp,0,sizeof(*MoMp)); + memset(kmdtxidp,0,sizeof(*kmdtxidp)); + *notarized_heightp = 0; + if ( depth > 0 && notarized_ht > 0 && nHeight > notarized_ht-depth && nHeight <= notarized_ht ) + { + *MoMp = MoM; + *notarized_heightp = notarized_ht; + *kmdtxidp = kmdtxid; + } + return(depth); +}*/ + int32_t komodo_checkpoint(int32_t *notarized_heightp,int32_t nHeight,uint256 hash) { - int32_t notarized_height; uint256 notarized_hash,notarized_desttxid; CBlockIndex *notary; CBlockIndex *pindex; + int32_t notarized_height,MoMdepth; uint256 MoM,notarized_hash,notarized_desttxid; CBlockIndex *notary,*pindex; if ( (pindex= chainActive.Tip()) == 0 ) return(-1); notarized_height = komodo_notarizeddata(pindex->nHeight,¬arized_hash,¬arized_desttxid); @@ -806,17 +930,18 @@ int32_t komodo_checkpoint(int32_t *notarized_heightp,int32_t nHeight,uint256 has { if ( nHeight < notarized_height ) { - fprintf(stderr,"nHeight.%d < NOTARIZED_HEIGHT.%d\n",nHeight,notarized_height); + //fprintf(stderr,"[%s] nHeight.%d < NOTARIZED_HEIGHT.%d\n",ASSETCHAINS_SYMBOL,nHeight,notarized_height); return(-1); } else if ( nHeight == notarized_height && memcmp(&hash,¬arized_hash,sizeof(hash)) != 0 ) { - fprintf(stderr,"nHeight.%d == NOTARIZED_HEIGHT.%d, diff hash\n",nHeight,notarized_height); + fprintf(stderr,"[%s] nHeight.%d == NOTARIZED_HEIGHT.%d, diff hash\n",ASSETCHAINS_SYMBOL,nHeight,notarized_height); return(-1); } - } else fprintf(stderr,"unexpected error notary_hash %s ht.%d at ht.%d\n",notarized_hash.ToString().c_str(),notarized_height,notary->nHeight); - } else if ( notarized_height > 0 && notarized_height != 73880 && notarized_height >= 170000 ) - fprintf(stderr,"[%s] couldnt find notarized.(%s %d) ht.%d\n",ASSETCHAINS_SYMBOL,notarized_hash.ToString().c_str(),notarized_height,pindex->nHeight); + } else fprintf(stderr,"[%s] unexpected error notary_hash %s ht.%d at ht.%d\n",ASSETCHAINS_SYMBOL,notarized_hash.ToString().c_str(),notarized_height,notary->nHeight); + } + //else if ( notarized_height > 0 && notarized_height != 73880 && notarized_height >= 170000 ) + // fprintf(stderr,"[%s] couldnt find notarized.(%s %d) ht.%d\n",ASSETCHAINS_SYMBOL,notarized_hash.ToString().c_str(),notarized_height,pindex->nHeight); return(0); } @@ -831,12 +956,13 @@ uint32_t komodo_interest_args(uint32_t *txheighttimep,int32_t *txheightp,uint32_ uint32_t locktime = 0; if ( n < tx.vout.size() ) { - if ( (pindex= mapBlockIndex[hashBlock]) != 0 && (tipindex= chainActive.Tip()) != 0 ) + if ( (pindex= mapBlockIndex[hashBlock]) != 0 ) { *valuep = tx.vout[n].nValue; *txheightp = pindex->nHeight; *txheighttimep = pindex->nTime; - *tiptimep = tipindex->nTime; + if ( *tiptimep == 0 && (tipindex= chainActive.Tip()) != 0 ) + *tiptimep = (uint32_t)tipindex->nTime; locktime = tx.nLockTime; //fprintf(stderr,"tx locktime.%u %.8f height.%d | tiptime.%u\n",locktime,(double)*valuep/COIN,*txheightp,*tiptimep); } @@ -845,9 +971,13 @@ uint32_t komodo_interest_args(uint32_t *txheighttimep,int32_t *txheightp,uint32_ } uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime); -uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue) + +uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight) { - uint64_t value; uint32_t tiptime,txheighttimep; + uint64_t value; uint32_t tiptime=0,txheighttimep; CBlockIndex *pindex; + if ( (pindex= chainActive[tipheight]) != 0 ) + tiptime = (uint32_t)pindex->nTime; + else fprintf(stderr,"cant find height[%d]\n",tipheight); if ( (*locktimep= komodo_interest_args(&txheighttimep,txheightp,&tiptime,&value,hash,n)) != 0 ) { if ( (checkvalue == 0 || value == checkvalue) && (checkheight == 0 || *txheightp == checkheight) ) @@ -882,7 +1012,7 @@ int32_t komodo_validate_interest(const CTransaction &tx,int32_t txheight,uint32_ { if ( tx.nLockTime != 1477258935 || dispflag != 0 ) { - //fprintf(stderr,"komodo_validate_interest.%d reject.%d [%d] locktime %u cmp2.%u\n",dispflag,txheight,(int32_t)(tx.nLockTime - (cmptime-3600)),(uint32_t)tx.nLockTime,cmptime); + fprintf(stderr,"komodo_validate_interest.%d reject.%d [%d] locktime %u cmp2.%u\n",dispflag,txheight,(int32_t)(tx.nLockTime - (cmptime-3600)),(uint32_t)tx.nLockTime,cmptime); } return(-1); } @@ -892,3 +1022,4 @@ int32_t komodo_validate_interest(const CTransaction &tx,int32_t txheight,uint32_ } return(0); } + diff --git a/src/komodo_globals.h b/src/komodo_globals.h index 144064d7a..904b57344 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -21,7 +21,7 @@ int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *n char *komodo_issuemethod(char *userpass,char *method,char *params,uint16_t port); void komodo_init(int32_t height); void komodo_assetchain_pubkeys(char *jsonstr); -int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33); +int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp); int32_t komodo_isrealtime(int32_t *kmdheightp); uint64_t komodo_paxtotal(); int32_t komodo_longestchain(); diff --git a/src/komodo_notary.h b/src/komodo_notary.h index a306f848f..f5c65dac3 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -13,6 +13,7 @@ * * ******************************************************************************/ + #include "komodo_defs.h" #include "komodo_cJSON.h" @@ -58,7 +59,7 @@ const char *Notaries_genesis[][2] = { "titomane_SH", "035f49d7a308dd9a209e894321f010d21b7793461b0c89d6d9231a3fe5f68d9960" }, }; -const char *Notaries_elected[][2] = +const char *Notaries_elected0[][2] = { { "0_jl777_testA", "03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828" }, { "0_jl777_testB", "02ebfc784a4ba768aad88d44d1045d240d47b26e248cafaf1c5169a42d7a61d344" }, @@ -126,64 +127,127 @@ const char *Notaries_elected[][2] = { "xxspot2_XX", "03d85b221ea72ebcd25373e7961f4983d12add66a92f899deaf07bab1d8b6f5573" } }; -int32_t komodo_electednotary(uint8_t *pubkey33,int32_t height) -{ - char pubkeystr[67]; int32_t i; uint8_t legacy33[33]; - for (i=0; i<33; i++) - sprintf(&pubkeystr[i*2],"%02x",pubkey33[i]); - pubkeystr[66] = 0; - //printf("%s vs\n",pubkeystr); - for (i=0; i elected %s\n",i,(char *)Notaries_elected[i][1]); - return(i); - } - } - /*if ( height < 300000 ) - { - for (i=0; i elected %s\n",i,(char *)Notaries_elected[i][1]); - return(i+64); - } - } - decode_hex(legacy33,33,(char *)"0252b6185bf8ea7efe8bbc345ddc8da87329149f30233088387abd716d4aa9e974"); - if ( memcmp(pubkey33,legacy33,33) == 0 ) - return(128); - }*/ - return(-1); -} +#define KOMODO_NOTARIES_TIMESTAMP1 1525132800 // May 1st 2018 1530921600 // 7/7/2017 +#define KOMODO_NOTARIES_HEIGHT1 ((820000 / KOMODO_ELECTION_GAP) * KOMODO_ELECTION_GAP) -int32_t komodo_ratify_threshold(int32_t height,uint64_t signedmask) +const char *Notaries_elected1[][2] = { - int32_t htind,numnotaries,i,wt = 0; - htind = height / KOMODO_ELECTION_GAP; - numnotaries = Pubkeys[htind].numnotaries; - for (i=0; i (numnotaries >> 1) || (wt > 7 && (signedmask & 1) != 0) ) - return(1); - else return(0); -} + {"0dev1_jl777", "03b7621b44118017a16043f19b30cc8a4cfe068ac4e42417bae16ba460c80f3828" }, + {"0dev2_kolo", "030f34af4b908fb8eb2099accb56b8d157d49f6cfb691baa80fdd34f385efed961" }, + {"0dev3_kolo", "025af9d2b2a05338478159e9ac84543968fd18c45fd9307866b56f33898653b014" }, + {"0dev4_decker", "028eea44a09674dda00d88ffd199a09c9b75ba9782382cc8f1e97c0fd565fe5707" }, + {"a-team_SH", "03b59ad322b17cb94080dc8e6dc10a0a865de6d47c16fb5b1a0b5f77f9507f3cce" }, + {"artik_AR", "029acf1dcd9f5ff9c455f8bb717d4ae0c703e089d16cf8424619c491dff5994c90" }, + {"artik_EU", "03f54b2c24f82632e3cdebe4568ba0acf487a80f8a89779173cdb78f74514847ce" }, + {"artik_NA", "0224e31f93eff0cc30eaf0b2389fbc591085c0e122c4d11862c1729d090106c842" }, + {"artik_SH", "02bdd8840a34486f38305f311c0e2ae73e84046f6e9c3dd3571e32e58339d20937" }, + {"badass_EU", "0209d48554768dd8dada988b98aca23405057ac4b5b46838a9378b95c3e79b9b9e" }, + {"badass_NA", "02afa1a9f948e1634a29dc718d218e9d150c531cfa852843a1643a02184a63c1a7" }, + {"batman_AR", "033ecb640ec5852f42be24c3bf33ca123fb32ced134bed6aa2ba249cf31b0f2563" }, + {"batman_SH", "02ca5898931181d0b8aafc75ef56fce9c43656c0b6c9f64306e7c8542f6207018c" }, + {"ca333_EU", "03fc87b8c804f12a6bd18efd43b0ba2828e4e38834f6b44c0bfee19f966a12ba99" }, + {"chainmakers_EU", "02f3b08938a7f8d2609d567aebc4989eeded6e2e880c058fdf092c5da82c3bc5ee" }, + {"chainmakers_NA", "0276c6d1c65abc64c8559710b8aff4b9e33787072d3dda4ec9a47b30da0725f57a" }, + {"chainstrike_SH", "0370bcf10575d8fb0291afad7bf3a76929734f888228bc49e35c5c49b336002153" }, + {"cipi_AR", "02c4f89a5b382750836cb787880d30e23502265054e1c327a5bfce67116d757ce8" }, + {"cipi_NA", "02858904a2a1a0b44df4c937b65ee1f5b66186ab87a751858cf270dee1d5031f18" }, + {"crackers_EU", "03bc819982d3c6feb801ec3b720425b017d9b6ee9a40746b84422cbbf929dc73c3" }, + {"crackers_NA", "03205049103113d48c7c7af811b4c8f194dafc43a50d5313e61a22900fc1805b45" }, + {"dwy_EU", "0259c646288580221fdf0e92dbeecaee214504fdc8bbdf4a3019d6ec18b7540424" }, + {"emmanux_SH", "033f316114d950497fc1d9348f03770cd420f14f662ab2db6172df44c389a2667a" }, + {"etszombi_EU", "0281b1ad28d238a2b217e0af123ce020b79e91b9b10ad65a7917216eda6fe64bf7" }, + {"fullmoon_AR", "03380314c4f42fa854df8c471618751879f9e8f0ff5dbabda2bd77d0f96cb35676" }, + {"fullmoon_NA", "030216211d8e2a48bae9e5d7eb3a42ca2b7aae8770979a791f883869aea2fa6eef" }, + {"fullmoon_SH", "03f34282fa57ecc7aba8afaf66c30099b5601e98dcbfd0d8a58c86c20d8b692c64" }, + {"goldenman_EU", "02d6f13a8f745921cdb811e32237bb98950af1a5952be7b3d429abd9152f8e388d" }, + {"indenodes_AR", "02ec0fa5a40f47fd4a38ea5c89e375ad0b6ddf4807c99733c9c3dc15fb978ee147" }, + {"indenodes_EU", "0221387ff95c44cb52b86552e3ec118a3c311ca65b75bf807c6c07eaeb1be8303c" }, + {"indenodes_NA", "02698c6f1c9e43b66e82dbb163e8df0e5a2f62f3a7a882ca387d82f86e0b3fa988" }, + {"indenodes_SH", "0334e6e1ec8285c4b85bd6dae67e17d67d1f20e7328efad17ce6fd24ae97cdd65e" }, + {"jackson_AR", "038ff7cfe34cb13b524e0941d5cf710beca2ffb7e05ddf15ced7d4f14fbb0a6f69" }, + {"jeezy_EU", "023cb3e593fb85c5659688528e9a4f1c4c7f19206edc7e517d20f794ba686fd6d6" }, + {"karasugoi_NA", "02a348b03b9c1a8eac1b56f85c402b041c9bce918833f2ea16d13452309052a982" }, + {"komodoninja_EU", "038e567b99806b200b267b27bbca2abf6a3e8576406df5f872e3b38d30843cd5ba" }, + {"komodoninja_SH", "033178586896915e8456ebf407b1915351a617f46984001790f0cce3d6f3ada5c2" }, + {"komodopioneers_SH", "033ace50aedf8df70035b962a805431363a61cc4e69d99d90726a2d48fb195f68c" }, + {"libscott_SH", "03301a8248d41bc5dc926088a8cf31b65e2daf49eed7eb26af4fb03aae19682b95" }, + {"lukechilds_AR", "031aa66313ee024bbee8c17915cf7d105656d0ace5b4a43a3ab5eae1e14ec02696" }, + {"madmax_AR", "03891555b4a4393d655bf76f0ad0fb74e5159a615b6925907678edc2aac5e06a75" }, + {"meshbits_AR", "02957fd48ae6cb361b8a28cdb1b8ccf5067ff68eb1f90cba7df5f7934ed8eb4b2c" }, + {"meshbits_SH", "025c6e94877515dfd7b05682b9cc2fe4a49e076efe291e54fcec3add78183c1edb" }, + {"metaphilibert_AR", "02adad675fae12b25fdd0f57250b0caf7f795c43f346153a31fe3e72e7db1d6ac6" }, + {"metaphilibert_SH", "0284af1a5ef01503e6316a2ca4abf8423a794e9fc17ac6846f042b6f4adedc3309" }, + {"patchkez_SH", "0296270f394140640f8fa15684fc11255371abb6b9f253416ea2734e34607799c4" }, + {"pbca26_NA", "0276aca53a058556c485bbb60bdc54b600efe402a8b97f0341a7c04803ce204cb5" }, + {"peer2cloud_AR", "034e5563cb885999ae1530bd66fab728e580016629e8377579493b386bf6cebb15" }, + {"peer2cloud_SH", "03396ac453b3f23e20f30d4793c5b8ab6ded6993242df4f09fd91eb9a4f8aede84" }, + {"polycryptoblog_NA", "02708dcda7c45fb54b78469673c2587bfdd126e381654819c4c23df0e00b679622" }, + {"hyper_AR", "020f2f984d522051bd5247b61b080b4374a7ab389d959408313e8062acad3266b4" }, + {"hyper_EU", "03d00cf9ceace209c59fb013e112a786ad583d7de5ca45b1e0df3b4023bb14bf51" }, + {"hyper_SH", "0383d0b37f59f4ee5e3e98a47e461c861d49d0d90c80e9e16f7e63686a2dc071f3" }, + {"hyper_NA", "03d91c43230336c0d4b769c9c940145a8c53168bf62e34d1bccd7f6cfc7e5592de" }, + {"popcornbag_AR", "02761f106fb34fbfc5ddcc0c0aa831ed98e462a908550b280a1f7bd32c060c6fa3" }, + {"popcornbag_NA", "03c6085c7fdfff70988fda9b197371f1caf8397f1729a844790e421ee07b3a93e8" }, + {"alien_AR", "0348d9b1fc6acf81290405580f525ee49b4749ed4637b51a28b18caa26543b20f0" }, + {"alien_EU", "020aab8308d4df375a846a9e3b1c7e99597b90497efa021d50bcf1bbba23246527" }, + {"thegaltmines_NA", "031bea28bec98b6380958a493a703ddc3353d7b05eb452109a773eefd15a32e421" }, + {"titomane_AR", "029d19215440d8cb9cc6c6b7a4744ae7fb9fb18d986e371b06aeb34b64845f9325" }, + {"titomane_EU", "0360b4805d885ff596f94312eed3e4e17cb56aa8077c6dd78d905f8de89da9499f" }, + {"titomane_SH", "03573713c5b20c1e682a2e8c0f8437625b3530f278e705af9b6614de29277a435b" }, + {"webworker01_NA", "03bb7d005e052779b1586f071834c5facbb83470094cff5112f0072b64989f97d7" }, + {"xrobesx_NA", "03f0cc6d142d14a40937f12dbd99dbd9021328f45759e26f1877f2a838876709e1" }, +}; -int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height) +int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp) { + static uint8_t elected_pubkeys0[64][33],elected_pubkeys1[64][33],did0,did1; int32_t i,htind,n; uint64_t mask = 0; struct knotary_entry *kp,*tmp; - if ( height >= 180000 || ASSETCHAINS_SYMBOL[0] != 0 ) + if ( timestamp == 0 && ASSETCHAINS_SYMBOL[0] != 0 ) + timestamp = komodo_heightstamp(height); + else if ( ASSETCHAINS_SYMBOL[0] == 0 ) + timestamp = 0; + if ( height >= KOMODO_NOTARIES_HARDCODED || ASSETCHAINS_SYMBOL[0] != 0 ) { - n = (int32_t)(sizeof(Notaries_elected)/sizeof(*Notaries_elected)); - for (i=0; i= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) + htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; + if ( Pubkeys == 0 ) + { + komodo_init(height); + //printf("Pubkeys.%p htind.%d vs max.%d\n",Pubkeys,htind,KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP); + } pthread_mutex_lock(&komodo_mutex); n = Pubkeys[htind].numnotaries; + if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) + fprintf(stderr,"%s height.%d t.%u genesis.%d\n",ASSETCHAINS_SYMBOL,height,timestamp,n); HASH_ITER(hh,Pubkeys[htind].Notaries,kp,tmp) { if ( kp->notaryid < n ) @@ -199,12 +263,40 @@ int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height) return(-1); } +int32_t komodo_electednotary(int32_t *numnotariesp,uint8_t *pubkey33,int32_t height,uint32_t timestamp) +{ + int32_t i,n; uint8_t pubkeys[64][33]; + n = komodo_notaries(pubkeys,height,timestamp); + *numnotariesp = n; + for (i=0; i= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) + htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; + numnotaries = Pubkeys[htind].numnotaries; + for (i=0; i (numnotaries >> 1) || (wt > 7 && (signedmask & 1) != 0) ) + return(1); + else return(0); +} + void komodo_notarysinit(int32_t origheight,uint8_t pubkeys[64][33],int32_t num) { static int32_t hwmheight; int32_t k,i,htind,height; struct knotary_entry *kp; struct knotaries_entry N; if ( Pubkeys == 0 ) - Pubkeys = (struct knotaries_entry *)calloc(KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP,sizeof(*Pubkeys)); + Pubkeys = (struct knotaries_entry *)calloc(1 + (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP),sizeof(*Pubkeys)); memset(&N,0,sizeof(N)); if ( origheight > 0 ) { @@ -212,6 +304,8 @@ void komodo_notarysinit(int32_t origheight,uint8_t pubkeys[64][33],int32_t num) height /= KOMODO_ELECTION_GAP; height = ((height + 1) * KOMODO_ELECTION_GAP); htind = (height / KOMODO_ELECTION_GAP); + if ( htind >= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) + htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; //printf("htind.%d activation %d from %d vs %d | hwmheight.%d %s\n",htind,height,origheight,(((origheight+KOMODO_ELECTION_GAP/2)/KOMODO_ELECTION_GAP)+1)*KOMODO_ELECTION_GAP,hwmheight,ASSETCHAINS_SYMBOL); } else htind = 0; pthread_mutex_lock(&komodo_mutex); @@ -244,29 +338,31 @@ void komodo_notarysinit(int32_t origheight,uint8_t pubkeys[64][33],int32_t num) hwmheight = origheight; } -int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33) +int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp) { // -1 if not notary, 0 if notary, 1 if special notary struct knotary_entry *kp; int32_t numnotaries=0,htind,modval = -1; - komodo_init(0); *notaryidp = -1; - if ( height < 0 || height >= KOMODO_MAXBLOCKS ) + if ( height < 0 )//|| height >= KOMODO_MAXBLOCKS ) { printf("komodo_chosennotary ht.%d illegal\n",height); return(-1); } - if ( height >= 180000 ) + if ( height >= KOMODO_NOTARIES_HARDCODED || ASSETCHAINS_SYMBOL[0] != 0 ) { - if ( (*notaryidp= komodo_electednotary(pubkey33,height)) >= 0 ) + if ( (*notaryidp= komodo_electednotary(&numnotaries,pubkey33,height,timestamp)) >= 0 && numnotaries != 0 ) { - numnotaries = (int32_t)(sizeof(Notaries_elected)/sizeof(*Notaries_elected)); modval = ((height % numnotaries) == *notaryidp); return(modval); } } - if ( height >= 250000 )//300000 ) + if ( height >= 250000 ) return(-1); + if ( Pubkeys == 0 ) + komodo_init(0); htind = height / KOMODO_ELECTION_GAP; + if ( htind >= KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP ) + htind = (KOMODO_MAXBLOCKS / KOMODO_ELECTION_GAP) - 1; pthread_mutex_lock(&komodo_mutex); HASH_FIND(hh,Pubkeys[htind].Notaries,pubkey33,33,kp); pthread_mutex_unlock(&komodo_mutex); @@ -285,27 +381,6 @@ int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33) return(modval); } -void komodo_notarized_update(struct komodo_state *sp,int32_t nHeight,int32_t notarized_height,uint256 notarized_hash,uint256 notarized_desttxid) -{ - struct notarized_checkpoint *np; - if ( notarized_height > nHeight ) - { - printf("komodo_notarized_update REJECT notarized_height %d > %d nHeight\n",notarized_height,nHeight); - return; - } - if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) - printf("[%s] komodo_notarized_update nHeight.%d notarized_height.%d\n",ASSETCHAINS_SYMBOL,nHeight,notarized_height); - portable_mutex_lock(&komodo_mutex); - sp->NPOINTS = (struct notarized_checkpoint *)realloc(sp->NPOINTS,(sp->NUM_NPOINTS+1) * sizeof(*sp->NPOINTS)); - np = &sp->NPOINTS[sp->NUM_NPOINTS++]; - memset(np,0,sizeof(*np)); - np->nHeight = nHeight; - sp->NOTARIZED_HEIGHT = np->notarized_height = notarized_height; - sp->NOTARIZED_HASH = np->notarized_hash = notarized_hash; - sp->NOTARIZED_DESTTXID = np->notarized_desttxid = notarized_desttxid; - portable_mutex_unlock(&komodo_mutex); -} - //struct komodo_state *komodo_stateptr(char *symbol,char *dest); int32_t komodo_notarized_height(uint256 *hashp,uint256 *txidp) { @@ -324,6 +399,43 @@ int32_t komodo_notarized_height(uint256 *hashp,uint256 *txidp) } } +/*struct notarized_checkpoint *komodo_npptr(int32_t height) +{ + char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; int32_t i; struct komodo_state *sp; struct notarized_checkpoint *np = 0; + if ( (sp= komodo_stateptr(symbol,dest)) != 0 ) + { + for (i=sp->NUM_NPOINTS-1; i>=0; i--) + { + np = &sp->NPOINTS[i]; + if ( np->MoMdepth > 0 && height > np->notarized_height-np->MoMdepth && height <= np->notarized_height ) + return(np); + } + } + return(0); +} + +int32_t komodo_MoMdata(int32_t *notarized_htp,uint256 *MoMp,uint256 *kmdtxidp,int32_t height,uint256 *MoMoMp,int32_t *MoMoMoffsetp,int32_t *MoMoMdepthp,int32_t *kmdstartip,int32_t *kmdendip) +{ + struct notarized_checkpoint *np = 0; + if ( (np= komodo_npptr(height)) != 0 ) + { + *notarized_htp = np->notarized_height; + *MoMp = np->MoM; + *kmdtxidp = np->notarized_desttxid; + *MoMoMp = np->MoMoM; + *MoMoMoffsetp = np->MoMoMoffset; + *MoMoMdepthp = np->MoMoMdepth; + *kmdstartip = np->kmdstarti; + *kmdendip = np->kmdendi; + return(np->MoMdepth); + } + *notarized_htp = *MoMoMoffsetp = *MoMoMdepthp = *kmdstartip = *kmdendip = 0; + memset(MoMp,0,sizeof(*MoMp)); + memset(MoMoMp,0,sizeof(*MoMoMp)); + memset(kmdtxidp,0,sizeof(*kmdtxidp)); + return(0); +}*/ + int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *notarized_desttxidp) { struct notarized_checkpoint *np = 0; int32_t i=0,flag = 0; char symbol[KOMODO_ASSETCHAIN_MAXLEN],dest[KOMODO_ASSETCHAIN_MAXLEN]; struct komodo_state *sp; @@ -380,11 +492,35 @@ int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *n return(0); } +void komodo_notarized_update(struct komodo_state *sp,int32_t nHeight,int32_t notarized_height,uint256 notarized_hash,uint256 notarized_desttxid,uint256 MoM,int32_t MoMdepth) +{ + struct notarized_checkpoint *np; + if ( notarized_height >= nHeight ) + { + fprintf(stderr,"komodo_notarized_update REJECT notarized_height %d > %d nHeight\n",notarized_height,nHeight); + return; + } + if ( 0 && ASSETCHAINS_SYMBOL[0] != 0 ) + fprintf(stderr,"[%s] komodo_notarized_update nHeight.%d notarized_height.%d\n",ASSETCHAINS_SYMBOL,nHeight,notarized_height); + portable_mutex_lock(&komodo_mutex); + sp->NPOINTS = (struct notarized_checkpoint *)realloc(sp->NPOINTS,(sp->NUM_NPOINTS+1) * sizeof(*sp->NPOINTS)); + np = &sp->NPOINTS[sp->NUM_NPOINTS++]; + memset(np,0,sizeof(*np)); + np->nHeight = nHeight; + sp->NOTARIZED_HEIGHT = np->notarized_height = notarized_height; + sp->NOTARIZED_HASH = np->notarized_hash = notarized_hash; + sp->NOTARIZED_DESTTXID = np->notarized_desttxid = notarized_desttxid; + sp->MoM = np->MoM = MoM; + sp->MoMdepth = np->MoMdepth = MoMdepth; + portable_mutex_unlock(&komodo_mutex); +} + void komodo_init(int32_t height) { static int didinit; uint256 zero; int32_t k,n; uint8_t pubkeys[64][33]; if ( 0 && height != 0 ) printf("komodo_init ht.%d didinit.%d\n",height,didinit); + memset(&zero,0,sizeof(zero)); if ( didinit == 0 ) { pthread_mutex_init(&komodo_mutex,NULL); @@ -400,56 +536,10 @@ void komodo_init(int32_t height) } komodo_notarysinit(0,pubkeys,k); } - memset(&zero,0,sizeof(zero)); //for (i=0; i 0 ) - { - for (i=0; iGetBlockHash() == hash ) + { + //fprintf(stderr,"got a pre notarization block that matches height.%d\n",(int32_t)nHeight); + return true; + } return state.DoS(100, error("%s: rejected by checkpoint lock-in at %d", __func__, nHeight),REJECT_CHECKPOINT, "checkpoint mismatch"); + } // Don't accept any forks from the main chain prior to last checkpoint CBlockIndex* pcheckpoint = Checkpoints::GetLastCheckpoint(chainParams.Checkpoints()); int32_t notarized_height; - if (pcheckpoint && (nHeight < pcheckpoint->nHeight || nHeight == 1 && chainActive.Tip() != 0 && chainActive.Tip()->nHeight > 1) ) + if (pcheckpoint && nHeight > 1 && nHeight < pcheckpoint->nHeight ) return state.DoS(100, error("%s: forked chain older than last checkpoint (height %d) vs %d", __func__, nHeight,pcheckpoint->nHeight)); else if ( komodo_checkpoint(¬arized_height,nHeight,hash) < 0 ) - return state.DoS(100, error("%s: forked chain %d older than last notarized (height %d) vs %d", __func__,nHeight, notarized_height)); + { + CBlockIndex *heightblock = chainActive[nHeight]; + if ( heightblock != 0 && heightblock->GetBlockHash() == hash ) + { + //fprintf(stderr,"got a pre notarization block that matches height.%d\n",(int32_t)nHeight); + return true; + } else return state.DoS(100, error("%s: forked chain %d older than last notarized (height %d) vs %d", __func__,nHeight, notarized_height)); + } } // Reject block.nVersion < 4 blocks if (block.nVersion < 4) @@ -3391,7 +3407,40 @@ bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, CBloc *ppindex = pindex; if (pindex != 0 && pindex->nStatus & BLOCK_FAILED_MASK) return state.Invalid(error("%s: block is marked invalid", __func__), 0, "duplicate"); - return true; + if ( pindex != 0 && IsInitialBlockDownload() == 0 ) // jl777 + { + if (!CheckBlockHeader(pindex->nHeight,pindex, block, state)) + { + pindex->nStatus |= BLOCK_FAILED_MASK; + fprintf(stderr,"known block failing CheckBlockHeader %d\n",(int32_t)pindex->nHeight); + return false; + } + CBlockIndex* pindexPrev = NULL; + if (hash != chainparams.GetConsensus().hashGenesisBlock) + { + BlockMap::iterator mi = mapBlockIndex.find(block.hashPrevBlock); + if (mi == mapBlockIndex.end()) + { + pindex->nStatus |= BLOCK_FAILED_MASK; + fprintf(stderr,"known block.%d failing to find prevblock\n",(int32_t)pindex->nHeight); + return state.DoS(10, error("%s: prev block not found", __func__), 0, "bad-prevblk"); + } + pindexPrev = (*mi).second; + if (pindexPrev == 0 || (pindexPrev->nStatus & BLOCK_FAILED_MASK) ) + { + pindex->nStatus |= BLOCK_FAILED_MASK; + fprintf(stderr,"known block.%d found invalid prevblock\n",(int32_t)pindex->nHeight); + return state.DoS(100, error("%s: prev block invalid", __func__), REJECT_INVALID, "bad-prevblk"); + } + } + if (!ContextualCheckBlockHeader(block, state, pindexPrev)) + { + pindex->nStatus |= BLOCK_FAILED_MASK; + fprintf(stderr,"known block.%d failing ContextualCheckBlockHeader\n",(int32_t)pindex->nHeight); + return false; + } + } + return true; } if (!CheckBlockHeader(*ppindex!=0?(*ppindex)->nHeight:0,*ppindex, block, state)) @@ -3995,7 +4044,6 @@ void UnloadBlockIndex() bool LoadBlockIndex() { - extern int32_t KOMODO_LOADINGBLOCKS; // Load block index from databases KOMODO_LOADINGBLOCKS = 1; if (!fReindex && !LoadBlockIndexDB()) @@ -4003,7 +4051,7 @@ bool LoadBlockIndex() KOMODO_LOADINGBLOCKS = 0; return false; } - KOMODO_LOADINGBLOCKS = 0; + //KOMODO_LOADINGBLOCKS = 0; fprintf(stderr,"finished loading blocks %s\n",ASSETCHAINS_SYMBOL); return true; } diff --git a/src/miner.cpp b/src/miner.cpp index d7fc3a94d..7c44915d2 100644 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -113,7 +113,7 @@ extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; extern std::string NOTARY_PUBKEY; extern uint8_t NOTARY_PUBKEY33[33]; uint32_t Mining_start,Mining_height; -int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33); +int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp); int32_t komodo_is_special(int32_t height,uint8_t pubkey33[33]); int32_t komodo_pax_opreturn(int32_t height,uint8_t *opret,int32_t maxsize); uint64_t komodo_paxtotal(); @@ -648,7 +648,7 @@ void static BitcoinMiner() break; } //sleep(60); - komodo_chosennotary(¬aryid,chainActive.Tip()->nHeight,NOTARY_PUBKEY33); + komodo_chosennotary(¬aryid,chainActive.Tip()->nHeight,NOTARY_PUBKEY33,(uint32_t)chainActive.Tip()->GetBlockTime()); std::string solver; //if ( notaryid >= 0 || ASSETCHAINS_SYMBOL[0] != 0 ) diff --git a/src/pow.cpp b/src/pow.cpp index 2bf0795a6..081cceb5e 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -115,41 +115,49 @@ bool CheckEquihashSolution(const CBlockHeader *pblock, const CChainParams& param return true; } -int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33); -int32_t komodo_is_special(int32_t height,uint8_t pubkey33[33]); +int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp); +int32_t komodo_is_special(uint8_t pubkeys[66][33],int32_t mids[66],int32_t height,uint8_t pubkey33[33],uint32_t timestamp); int32_t komodo_currentheight(); CBlockIndex *komodo_chainactive(int32_t height); -int8_t komodo_minerid(int32_t height,uint8_t *pubkey33); void komodo_index2pubkey33(uint8_t *pubkey33,CBlockIndex *pindex,int32_t height); extern int32_t KOMODO_CHOSEN_ONE; +extern uint64_t ASSETCHAINS_STAKED; +extern char ASSETCHAINS_SYMBOL[]; #define KOMODO_ELECTION_GAP 2000 - + int32_t komodo_eligiblenotary(uint8_t pubkeys[66][33],int32_t *mids,int32_t *nonzpkeysp,int32_t height); -int32_t KOMODO_LOADINGBLOCKS; +int32_t KOMODO_LOADINGBLOCKS = 1; extern std::string NOTARY_PUBKEY; bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned int nBits, const Consensus::Params& params) { extern int32_t KOMODO_REWIND; - bool fNegative,fOverflow; int32_t i,nonzpkeys=0,nonz=0,special=0,special2=0,notaryid=-1,duplicate,flag = 0, mids[66]; - arith_uint256 bnTarget; CBlockIndex *pindex; uint8_t pubkeys[66][33]; - + bool fNegative,fOverflow; uint8_t origpubkey33[33]; int32_t i,nonzpkeys=0,nonz=0,special=0,special2=0,notaryid=-1,flag = 0, mids[66]; uint32_t timestamp = 0; CBlockIndex *pindex=0; + arith_uint256 bnTarget; uint8_t pubkeys[66][33]; + memcpy(origpubkey33,pubkey33,33); + timestamp = komodo_chainactive_timestamp(); bnTarget.SetCompact(nBits, &fNegative, &fOverflow); if ( height == 0 ) - height = komodo_currentheight() + 1; - special = komodo_chosennotary(¬aryid,height,pubkey33); - flag = komodo_eligiblenotary(pubkeys,mids,&nonzpkeys,height); - if ( height > 34000 ) // 0 -> non-special notary { + height = komodo_currentheight() + 1; + //fprintf(stderr,"set height to %d\n",height); + } + if ( height > 34000 && ASSETCHAINS_SYMBOL[0] == 0 ) // 0 -> non-special notary + { + special = komodo_chosennotary(¬aryid,height,pubkey33,timestamp); for (i=0; i<33; i++) { if ( pubkey33[i] != 0 ) nonz++; } if ( nonz == 0 ) + { + //fprintf(stderr,"ht.%d null pubkey checkproof return\n",height); return(true); // will come back via different path with pubkey set - special2 = komodo_is_special(height,pubkey33); + } + flag = komodo_eligiblenotary(pubkeys,mids,&nonzpkeys,height); + special2 = komodo_is_special(pubkeys,mids,height,pubkey33,timestamp); if ( notaryid >= 0 ) { if ( height > 10000 && height < 80000 && (special != 0 || special2 > 0) ) @@ -158,8 +166,19 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in flag = 1; else if ( height >= 108000 && special2 > 0 ) flag = ((height % KOMODO_ELECTION_GAP) > 64 || (height % KOMODO_ELECTION_GAP) == 0); - if ( flag != 0 || height == 790833 ) + else if ( height == 790833 ) + flag = 1; + else if ( special2 < 0 ) + { + if ( height > 792000 ) + flag = 0; + else fprintf(stderr,"ht.%d notaryid.%d special.%d flag.%d special2.%d\n",height,notaryid,special,flag,special2); + } + if ( flag != 0 || special2 > 0 ) + { + //fprintf(stderr,"EASY MINING ht.%d\n",height); bnTarget.SetCompact(KOMODO_MINDIFF_NBITS,&fNegative,&fOverflow); + } } } if (fNegative || bnTarget == 0 || fOverflow || bnTarget > UintToArith256(params.powLimit)) @@ -167,39 +186,10 @@ bool CheckProofOfWork(int32_t height,uint8_t *pubkey33,uint256 hash, unsigned in // Check proof of work matches claimed amount if ( UintToArith256(hash) > bnTarget ) { - if ( (height < 235300 || height >= 236000) && KOMODO_LOADINGBLOCKS == 0 && height > 188000 ) - //&& )//186269, 182507&& komodo_chainactive(height) != 0 && nonzpkeys > 0 - { - for (i=31; i>=0; i--) - printf("%02x",((uint8_t *)&hash)[i]); - printf(" hash vs "); - for (i=31; i>=0; i--) - printf("%02x",((uint8_t *)&bnTarget)[i]); - printf(" ht.%d special.%d notaryid.%d ht.%d mod.%d error\n",height,special,notaryid,height,(height % 35)); - for (i=0; i<33; i++) - printf("%02x",pubkey33[i]); - printf(" <- pubkey\n"); - for (i=0; i<66; i++) - printf("%d ",mids[i]); - printf(" minerids from ht.%d\n",height); - if ( KOMODO_REWIND == 0 && (notaryid >= 0 || height > 225000) ) - { - fprintf(stderr,"pow error height.%d loading.%d notaryid.%d\n",height,KOMODO_LOADINGBLOCKS,notaryid); - return error("CheckProofOfWork(): hash doesn't match nBits"); - } else fprintf(stderr,"skip return error height.%d loading.%d\n",height,KOMODO_LOADINGBLOCKS); - } //else fprintf(stderr,"skip height.%d loading.%d\n",height,KOMODO_LOADINGBLOCKS); - } - if ( 0 && height > 248000 ) - { - for (i=31; i>=0; i--) - fprintf(stderr,"%02x",((uint8_t *)&hash)[i]); - fprintf(stderr," hash vs "); - for (i=31; i>=0; i--) - fprintf(stderr,"%02x",((uint8_t *)&bnTarget)[i]); - fprintf(stderr," POW ok for ht.%d notaryid.%d: ",height,notaryid); - for (i=0; i<33; i++) - fprintf(stderr,"%02x",pubkey33[i]); - fprintf(stderr,"\n"); + if ( KOMODO_LOADINGBLOCKS != 0 ) + return true; + if ( ASSETCHAINS_SYMBOL[0] != 0 || height > 792000 ) + return false; } return true; } diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 10f617765..3947b65e3 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -519,10 +519,10 @@ UniValue gettxoutsetinfo(const UniValue& params, bool fHelp) #define KOMODO_KVBINARY 2 extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime); -uint32_t komodo_txtime(uint256 hash); +//uint32_t komodo_txtime(uint256 hash); uint64_t komodo_paxprice(uint64_t *seedp,int32_t height,char *base,char *rel,uint64_t basevolume); int32_t komodo_paxprices(int32_t *heights,uint64_t *prices,int32_t max,char *base,char *rel); -int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height); +int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp); char *bitcoin_address(char *coinaddr,uint8_t addrtype,uint8_t *pubkey_or_rmd160,int32_t len); //uint32_t komodo_interest_args(int32_t *txheightp,uint32_t *tiptimep,uint64_t *valuep,uint256 hash,int32_t n); int32_t komodo_minerids(uint8_t *minerids,int32_t height,int32_t width); @@ -581,13 +581,19 @@ UniValue kvsearch(const UniValue& params, bool fHelp) UniValue minerids(const UniValue& params, bool fHelp) { - UniValue ret(UniValue::VOBJ); UniValue a(UniValue::VARR); uint8_t minerids[2000],pubkeys[65][33]; int32_t i,j,n,numnotaries,tally[129]; + uint32_t timestamp = 0; UniValue ret(UniValue::VOBJ); UniValue a(UniValue::VARR); uint8_t minerids[2000],pubkeys[65][33]; int32_t i,j,n,numnotaries,tally[129]; if ( fHelp || params.size() != 1 ) throw runtime_error("minerids needs height\n"); LOCK(cs_main); int32_t height = atoi(params[0].get_str().c_str()); if ( height <= 0 ) height = chainActive.Tip()->nHeight; + else + { + CBlockIndex *pblockindex = chainActive[height]; + if ( pblockindex != 0 ) + timestamp = pblockindex->GetBlockTime(); + } if ( (n= komodo_minerids(minerids,height,(int32_t)(sizeof(minerids)/sizeof(*minerids)))) > 0 ) { memset(tally,0,sizeof(tally)); @@ -632,49 +638,57 @@ UniValue minerids(const UniValue& params, bool fHelp) UniValue notaries(const UniValue& params, bool fHelp) { - UniValue a(UniValue::VARR); UniValue ret(UniValue::VOBJ); int32_t i,j,n,m; char *hexstr; uint8_t pubkeys[64][33]; char btcaddr[64],kmdaddr[64],*ptr; - if ( fHelp || params.size() != 1 ) - throw runtime_error("notaries height\n"); + UniValue a(UniValue::VARR); uint32_t timestamp=0; UniValue ret(UniValue::VOBJ); int32_t i,j,n,m; char *hexstr; uint8_t pubkeys[64][33]; char btcaddr[64],kmdaddr[64],*ptr; + if ( fHelp || (params.size() != 1 && params.size() != 2) ) + throw runtime_error("notaries height timestamp\n"); LOCK(cs_main); int32_t height = atoi(params[0].get_str().c_str()); + if ( params.size() == 2 ) + timestamp = (uint32_t)atol(params[1].get_str().c_str()); + else timestamp = (uint32_t)time(NULL); if ( height < 0 ) - height = chainActive.Tip()->nHeight; - //fprintf(stderr,"notaries as of height.%d\n",height); - //if ( height > chainActive.Height()+20000 ) - // throw JSONRPCError(RPC_INVALID_PARAMETER, "Block height out of range"); - //else { - if ( (n= komodo_notaries(pubkeys,height)) > 0 ) - { - for (i=0; inHeight; + timestamp = chainActive.Tip()->GetBlockTime(); } + else if ( params.size() < 2 ) + { + CBlockIndex *pblockindex = chainActive[height]; + if ( pblockindex != 0 ) + timestamp = pblockindex->GetBlockTime(); + } + if ( (n= komodo_notaries(pubkeys,height,timestamp)) > 0 ) + { + for (i=0; inHeight)) >= 0 ) + if ( (notaryid= komodo_whoami(pubkeystr,(int32_t)chainActive.Tip()->nHeight,komodo_chainactive_timestamp())) >= 0 ) { obj.push_back(Pair("notaryid", notaryid)); obj.push_back(Pair("pubkey", pubkeystr)); From 49311c0553a496109b5e66c236ef1151bb6a064b Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Apr 2018 01:46:51 +0300 Subject: [PATCH 37/49] Syntax fixes --- src/coins.cpp | 4 ++-- src/komodo-tx.cpp | 2 +- src/komodo_notary.h | 8 ++++---- src/komodo_structs.h | 1 + src/main.cpp | 2 +- src/pow.cpp | 1 + src/rpcblockchain.cpp | 4 ++-- src/rpcmisc.cpp | 1 + src/wallet/rpcwallet.cpp | 4 ++-- src/wallet/wallet.cpp | 4 ++-- 10 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/coins.cpp b/src/coins.cpp index 37d969010..272beb3d1 100644 --- a/src/coins.cpp +++ b/src/coins.cpp @@ -387,7 +387,7 @@ const CScript &CCoinsViewCache::GetSpendFor(const CTxIn& input) const } //uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime); -uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue); +uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight); extern char ASSETCHAINS_SYMBOL[KOMODO_ASSETCHAIN_MAXLEN]; CAmount CCoinsViewCache::GetValueIn(int32_t nHeight,int64_t *interestp,const CTransaction& tx,uint32_t tiptime) const @@ -407,7 +407,7 @@ CAmount CCoinsViewCache::GetValueIn(int32_t nHeight,int64_t *interestp,const CTr if ( value >= 10*COIN ) { int64_t interest; int32_t txheight; uint32_t locktime; - interest = komodo_accrued_interest(&txheight,&locktime,tx.vin[i].prevout.hash,tx.vin[i].prevout.n,0,value); + interest = komodo_accrued_interest(&txheight,&locktime,tx.vin[i].prevout.hash,tx.vin[i].prevout.n,0,value,(int32_t)nHeight); //printf("nResult %.8f += val %.8f interest %.8f ht.%d lock.%u tip.%u\n",(double)nResult/COIN,(double)value/COIN,(double)interest/COIN,txheight,locktime,tiptime); //fprintf(stderr,"nResult %.8f += val %.8f interest %.8f ht.%d lock.%u tip.%u\n",(double)nResult/COIN,(double)value/COIN,(double)interest/COIN,txheight,locktime,tiptime); nResult += interest; diff --git a/src/komodo-tx.cpp b/src/komodo-tx.cpp index 645bc30a2..bce749d7f 100644 --- a/src/komodo-tx.cpp +++ b/src/komodo-tx.cpp @@ -31,7 +31,7 @@ using namespace std; #include "komodo_interest.h" -uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue) +uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight) { return(0); } diff --git a/src/komodo_notary.h b/src/komodo_notary.h index f5c65dac3..38eced369 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -492,7 +492,7 @@ int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *n return(0); } -void komodo_notarized_update(struct komodo_state *sp,int32_t nHeight,int32_t notarized_height,uint256 notarized_hash,uint256 notarized_desttxid,uint256 MoM,int32_t MoMdepth) +void komodo_notarized_update(struct komodo_state *sp,int32_t nHeight,int32_t notarized_height,uint256 notarized_hash,uint256 notarized_desttxid)//,uint256 MoM,int32_t MoMdepth) { struct notarized_checkpoint *np; if ( notarized_height >= nHeight ) @@ -510,8 +510,8 @@ void komodo_notarized_update(struct komodo_state *sp,int32_t nHeight,int32_t not sp->NOTARIZED_HEIGHT = np->notarized_height = notarized_height; sp->NOTARIZED_HASH = np->notarized_hash = notarized_hash; sp->NOTARIZED_DESTTXID = np->notarized_desttxid = notarized_desttxid; - sp->MoM = np->MoM = MoM; - sp->MoMdepth = np->MoMdepth = MoMdepth; + //sp->MoM = np->MoM = MoM; + //sp->MoMdepth = np->MoMdepth = MoMdepth; portable_mutex_unlock(&komodo_mutex); } @@ -539,7 +539,7 @@ void komodo_init(int32_t height) //for (i=0; ivout[prevout.n].nValue >= 10*COIN ) { int64_t interest; int32_t txheight; uint32_t locktime; - if ( (interest= komodo_accrued_interest(&txheight,&locktime,prevout.hash,prevout.n,0,coins->vout[prevout.n].nValue)) != 0 ) + if ( (interest= komodo_accrued_interest(&txheight,&locktime,prevout.hash,prevout.n,0,coins->vout[prevout.n].nValue,(int32_t)nSpendHeight-1)) != 0 ) { //fprintf(stderr,"checkResult %.8f += val %.8f interest %.8f ht.%d lock.%u tip.%u\n",(double)nValueIn/COIN,(double)coins->vout[prevout.n].nValue/COIN,(double)interest/COIN,txheight,locktime,chainActive.Tip()->nTime); nValueIn += interest; diff --git a/src/pow.cpp b/src/pow.cpp index 081cceb5e..ce82a4e1b 100644 --- a/src/pow.cpp +++ b/src/pow.cpp @@ -115,6 +115,7 @@ bool CheckEquihashSolution(const CBlockHeader *pblock, const CChainParams& param return true; } +uint32_t komodo_chainactive_timestamp(); int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp); int32_t komodo_is_special(uint8_t pubkeys[66][33],int32_t mids[66],int32_t height,uint8_t pubkey33[33],uint32_t timestamp); int32_t komodo_currentheight(); diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index 3947b65e3..caecbc5e1 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -801,7 +801,7 @@ UniValue paxprices(const UniValue& params, bool fHelp) return ret; } -uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue); +uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight); UniValue gettxout(const UniValue& params, bool fHelp) { @@ -874,7 +874,7 @@ UniValue gettxout(const UniValue& params, bool fHelp) else ret.push_back(Pair("confirmations", pindex->nHeight - coins.nHeight + 1)); ret.push_back(Pair("value", ValueFromAmount(coins.vout[n].nValue))); uint64_t interest; int32_t txheight; uint32_t locktime; - if ( (interest= komodo_accrued_interest(&txheight,&locktime,hash,n,coins.nHeight,coins.vout[n].nValue)) != 0 ) + if ( (interest= komodo_accrued_interest(&txheight,&locktime,hash,n,coins.nHeight,coins.vout[n].nValue,(int32_t)pindex->nHeight)) != 0 ) ret.push_back(Pair("interest", ValueFromAmount(interest))); UniValue o(UniValue::VOBJ); ScriptPubKeyToJSON(coins.vout[n].scriptPubKey, o, true); diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp index 2ef749049..e17285630 100644 --- a/src/rpcmisc.cpp +++ b/src/rpcmisc.cpp @@ -51,6 +51,7 @@ extern int32_t KOMODO_LASTMINED,JUMBLR_PAUSE; extern char ASSETCHAINS_SYMBOL[]; int32_t notarizedtxid_height(char *dest,char *txidstr,int32_t *kmdnotarized_heightp); #define KOMODO_VERSION "0.1.1" +uint32_t komodo_chainactive_timestamp(); UniValue getinfo(const UniValue& params, bool fHelp) { diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index ccf4fc34a..c407b0174 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -72,7 +72,7 @@ void EnsureWalletIsUnlocked() throw JSONRPCError(RPC_WALLET_UNLOCK_NEEDED, "Error: Please enter the wallet passphrase with walletpassphrase first."); } -uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue); +uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight); uint64_t komodo_interest(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime); void WalletTxToJSON(const CWalletTx& wtx, UniValue& entry) @@ -2668,9 +2668,9 @@ UniValue listunspent(const UniValue& params, bool fHelp) BlockMap::iterator it = mapBlockIndex.find(pcoinsTip->GetBestBlock()); CBlockIndex *tipindex,*pindex = it->second; uint64_t interest; uint32_t locktime; int32_t txheight; - komodo_accrued_interest(&txheight,&locktime,out.tx->GetHash(),out.i,0,nValue); if ( pindex != 0 && (tipindex= chainActive.Tip()) != 0 ) { + komodo_accrued_interest(&txheight,&locktime,out.tx->GetHash(),out.i,0,nValue,(int32_t)tipindex->nHeight); interest = komodo_interest(txheight,nValue,out.tx->nLockTime,tipindex->nTime); entry.push_back(Pair("interest",ValueFromAmount(interest))); } diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 9dc96f10c..0532f99d8 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2205,7 +2205,7 @@ CAmount CWallet::GetImmatureWatchOnlyBalance() const * populate vCoins with vector of available COutputs. */ uint64_t komodo_interestnew(int32_t txheight,uint64_t nValue,uint32_t nLockTime,uint32_t tiptime); -uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue); +uint64_t komodo_accrued_interest(int32_t *txheightp,uint32_t *locktimep,uint256 hash,int32_t n,int32_t checkheight,uint64_t checkvalue,int32_t tipheight); void CWallet::AvailableCoins(vector& vCoins, bool fOnlyConfirmed, const CCoinControl *coinControl, bool fIncludeZeroValue, bool fIncludeCoinBase) const { @@ -2249,9 +2249,9 @@ void CWallet::AvailableCoins(vector& vCoins, bool fOnlyConfirmed, const { if ( pcoin->vout[i].nValue >= 10*COIN ) { - komodo_accrued_interest(&txheight,&locktime,wtxid,i,0,pcoin->vout[i].nValue); if ( (tipindex= chainActive.Tip()) != 0 ) { + komodo_accrued_interest(&txheight,&locktime,wtxid,i,0,pcoin->vout[i].nValue,(int32_t)tipindex->nHeight); interest = komodo_interestnew(txheight,pcoin->vout[i].nValue,locktime,tipindex->nTime); } else interest = 0; //interest = komodo_interestnew(chainActive.Tip()->nHeight+1,pcoin->vout[i].nValue,pcoin->nLockTime,chainActive.Tip()->nTime); From aeabfddd56b293d83460c3411e1eb1b2c7e501a7 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Apr 2018 01:48:36 +0300 Subject: [PATCH 38/49] syntax --- src/komodo_notary.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 38eced369..5fcc15312 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -539,7 +539,7 @@ void komodo_init(int32_t height) //for (i=0; i Date: Sat, 14 Apr 2018 01:49:59 +0300 Subject: [PATCH 39/49] Add timestamp --- src/rpcblockchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index caecbc5e1..9919d161d 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -597,7 +597,7 @@ UniValue minerids(const UniValue& params, bool fHelp) if ( (n= komodo_minerids(minerids,height,(int32_t)(sizeof(minerids)/sizeof(*minerids)))) > 0 ) { memset(tally,0,sizeof(tally)); - numnotaries = komodo_notaries(pubkeys,height); + numnotaries = komodo_notaries(pubkeys,height,timestamp); if ( numnotaries > 0 ) { for (i=0; i Date: Sat, 14 Apr 2018 01:55:51 +0300 Subject: [PATCH 40/49] -assetchain_pubkeys --- src/komodo_globals.h | 2 +- src/komodo_utils.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/komodo_globals.h b/src/komodo_globals.h index 904b57344..7acdb9ccc 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -20,7 +20,7 @@ void komodo_init(int32_t height); int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *notarized_desttxidp); char *komodo_issuemethod(char *userpass,char *method,char *params,uint16_t port); void komodo_init(int32_t height); -void komodo_assetchain_pubkeys(char *jsonstr); +//void komodo_assetchain_pubkeys(char *jsonstr); int32_t komodo_chosennotary(int32_t *notaryidp,int32_t height,uint8_t *pubkey33,uint32_t timestamp); int32_t komodo_isrealtime(int32_t *kmdheightp); uint64_t komodo_paxtotal(); diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 995f81002..8b724c40b 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1564,8 +1564,8 @@ void komodo_args(char *argv0) COINBASE_MATURITY = 1; LogPrintf("ASSETCHAINS_PORT %s %u\n",ASSETCHAINS_SYMBOL,ASSETCHAINS_PORT); } - ASSETCHAINS_NOTARIES = GetArg("-ac_notaries",""); - komodo_assetchain_pubkeys((char *)ASSETCHAINS_NOTARIES.c_str()); + //ASSETCHAINS_NOTARIES = GetArg("-ac_notaries",""); + //komodo_assetchain_pubkeys((char *)ASSETCHAINS_NOTARIES.c_str()); iguana_rwnum(1,magic,sizeof(ASSETCHAINS_MAGIC),(void *)&ASSETCHAINS_MAGIC); for (i=0; i<4; i++) sprintf(&magicstr[i<<1],"%02x",magic[i]); From 92833827400ed1347842485184ae32985a9dd432 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Apr 2018 01:57:38 +0300 Subject: [PATCH 41/49] +komodo_heightstamp --- src/komodo_globals.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/komodo_globals.h b/src/komodo_globals.h index 7acdb9ccc..2a7cdaf3d 100644 --- a/src/komodo_globals.h +++ b/src/komodo_globals.h @@ -15,6 +15,7 @@ #include "komodo_defs.h" +uint32_t komodo_heightstamp(int32_t height); void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t kheight,uint32_t ktime,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout); void komodo_init(int32_t height); int32_t komodo_notarizeddata(int32_t nHeight,uint256 *notarized_hashp,uint256 *notarized_desttxidp); From 616b8051f4b44736fca1465f00a9bd480436362f Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Apr 2018 01:59:06 +0300 Subject: [PATCH 42/49] +heightstamp --- src/komodo_notary.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/komodo_notary.h b/src/komodo_notary.h index 5fcc15312..e7ae7d738 100644 --- a/src/komodo_notary.h +++ b/src/komodo_notary.h @@ -198,6 +198,8 @@ const char *Notaries_elected1[][2] = {"xrobesx_NA", "03f0cc6d142d14a40937f12dbd99dbd9021328f45759e26f1877f2a838876709e1" }, }; +uint32_t komodo_heightstamp(int32_t height); + int32_t komodo_notaries(uint8_t pubkeys[64][33],int32_t height,uint32_t timestamp) { static uint8_t elected_pubkeys0[64][33],elected_pubkeys1[64][33],did0,did1; From 7cc106cc871a7bbf9fb94e285813923eadd9c428 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Apr 2018 02:01:56 +0300 Subject: [PATCH 43/49] Add stub --- src/bitcoin-cli.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index cac650a00..6e116adf2 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -75,6 +75,11 @@ public: #include "komodo_cJSON.c" #include "komodo_notary.h" +uint32_t komodo_heightstamp(int32_t height) +{ + return(0); +} + void komodo_stateupdate(int32_t height,uint8_t notarypubs[][33],uint8_t numnotaries,uint8_t notaryid,uint256 txhash,uint64_t voutmask,uint8_t numvouts,uint32_t *pvals,uint8_t numpvals,int32_t KMDheight,uint32_t KMDtimestamp,uint64_t opretvalue,uint8_t *opretbuf,uint16_t opretlen,uint16_t vout) { From b3b20b8b25d65da7de11f87926214933f6508f06 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Apr 2018 03:14:07 +0300 Subject: [PATCH 44/49] -print --- src/arith_uint256.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arith_uint256.cpp b/src/arith_uint256.cpp index a1865b649..c9074fe91 100644 --- a/src/arith_uint256.cpp +++ b/src/arith_uint256.cpp @@ -111,7 +111,7 @@ int base_uint::CompareTo(const base_uint& b) const { if ( (uint64_t)pn < 0x1000 || (uint64_t)b.pn <= 0x1000 ) { - fprintf(stderr,"CompareTo null %p or %p\n",pn,b.pn); + //fprintf(stderr,"CompareTo null %p or %p\n",pn,b.pn); return(0); } for (int i = WIDTH - 1; i >= 0; i--) { From 28616d3592fa82d114372b8823896655fa91fe26 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Apr 2018 15:56:31 +0300 Subject: [PATCH 45/49] Fix possible buffer overflow and reduce KMD memory usage --- src/komodo_events.h | 102 ++++++++++++++++++++++++-------------------- 1 file changed, 56 insertions(+), 46 deletions(-) diff --git a/src/komodo_events.h b/src/komodo_events.h index ff054c3bb..c64ccbaa2 100644 --- a/src/komodo_events.h +++ b/src/komodo_events.h @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright © 2014-2017 The SuperNET Developers. * + * Copyright © 2014-2018 The SuperNET Developers. * * * * See the AUTHORS, DEVELOPER-AGREEMENT and LICENSE files at * * the top-level directory of this distribution for the individual copyright * @@ -20,7 +20,7 @@ struct komodo_event *komodo_eventadd(struct komodo_state *sp,int32_t height,char *symbol,uint8_t type,uint8_t *data,uint16_t datalen) { struct komodo_event *ep=0; uint16_t len = (uint16_t)(sizeof(*ep) + datalen); - if ( sp != 0 ) + if ( sp != 0 && ASSETCHAINS_SYMBOL[0] != 0 ) { portable_mutex_lock(&komodo_mutex); ep = (struct komodo_event *)calloc(1,len); @@ -37,10 +37,10 @@ struct komodo_event *komodo_eventadd(struct komodo_state *sp,int32_t height,char return(ep); } -void komodo_eventadd_notarized(struct komodo_state *sp,char *symbol,int32_t height,char *dest,uint256 notarized_hash,uint256 notarized_desttxid,int32_t notarizedheight) +void komodo_eventadd_notarized(struct komodo_state *sp,char *symbol,int32_t height,char *dest,uint256 notarized_hash,uint256 notarized_desttxid,int32_t notarizedheight,uint256 MoM,int32_t MoMdepth) { struct komodo_event_notarized N; - if ( komodo_verifynotarization(symbol,dest,height,notarizedheight,notarized_hash,notarized_desttxid) != 0 ) + if ( NOTARY_PUBKEY33[0] != 0 && komodo_verifynotarization(symbol,dest,height,notarizedheight,notarized_hash,notarized_desttxid) != 0 ) { if ( height > 50000 || ASSETCHAINS_SYMBOL[0] != 0 ) printf("[%s] error validating notarization ht.%d notarized_height.%d, if on a pruned %s node this can be ignored\n",ASSETCHAINS_SYMBOL,height,notarizedheight,dest); @@ -53,10 +53,12 @@ void komodo_eventadd_notarized(struct komodo_state *sp,char *symbol,int32_t heig N.blockhash = notarized_hash; N.desttxid = notarized_desttxid; N.notarizedheight = notarizedheight; - strcpy(N.dest,dest); + N.MoM = MoM; + N.MoMdepth = MoMdepth; + strncpy(N.dest,dest,sizeof(N.dest)-1); komodo_eventadd(sp,height,symbol,KOMODO_EVENT_NOTARIZED,(uint8_t *)&N,sizeof(N)); if ( sp != 0 ) - komodo_notarized_update(sp,height,notarizedheight,notarized_hash,notarized_desttxid); + komodo_notarized_update(sp,height,notarizedheight,notarized_hash,notarized_desttxid,MoM,MoMdepth); } } @@ -75,27 +77,34 @@ void komodo_eventadd_pubkeys(struct komodo_state *sp,char *symbol,int32_t height void komodo_eventadd_pricefeed(struct komodo_state *sp,char *symbol,int32_t height,uint32_t *prices,uint8_t num) { struct komodo_event_pricefeed F; - memset(&F,0,sizeof(F)); - F.num = num; - memcpy(F.prices,prices,sizeof(*F.prices) * num); - komodo_eventadd(sp,height,symbol,KOMODO_EVENT_PRICEFEED,(uint8_t *)&F,(int32_t)(sizeof(F.num) + sizeof(*F.prices) * num)); - if ( sp != 0 ) - komodo_pvals(height,prices,num); + if ( num == sizeof(F.prices)/sizeof(*F.prices) ) + { + memset(&F,0,sizeof(F)); + F.num = num; + memcpy(F.prices,prices,sizeof(*F.prices) * num); + komodo_eventadd(sp,height,symbol,KOMODO_EVENT_PRICEFEED,(uint8_t *)&F,(int32_t)(sizeof(F.num) + sizeof(*F.prices) * num)); + if ( sp != 0 ) + komodo_pvals(height,prices,num); + } //else fprintf(stderr,"skip pricefeed[%d]\n",num); } void komodo_eventadd_opreturn(struct komodo_state *sp,char *symbol,int32_t height,uint256 txid,uint64_t value,uint16_t vout,uint8_t *buf,uint16_t opretlen) { - struct komodo_event_opreturn O; uint8_t opret[16384]; - memset(&O,0,sizeof(O)); - O.txid = txid; - O.value = value; - O.vout = vout; - memcpy(opret,&O,sizeof(O)); - memcpy(&opret[sizeof(O)],buf,opretlen); - O.oplen = (int32_t)(opretlen + sizeof(O)); - komodo_eventadd(sp,height,symbol,KOMODO_EVENT_OPRETURN,opret,O.oplen); - if ( sp != 0 ) - komodo_opreturn(height,value,buf,opretlen,txid,vout,symbol); + struct komodo_event_opreturn O; uint8_t *opret; + if ( ASSETCHAINS_SYMBOL[0] != 0 ) + { + opret = (uint8_t *)calloc(1,sizeof(O) + opretlen + 16); + O.txid = txid; + O.value = value; + O.vout = vout; + memcpy(opret,&O,sizeof(O)); + memcpy(&opret[sizeof(O)],buf,opretlen); + O.oplen = (int32_t)(opretlen + sizeof(O)); + komodo_eventadd(sp,height,symbol,KOMODO_EVENT_OPRETURN,opret,O.oplen); + free(opret); + if ( sp != 0 ) + komodo_opreturn(height,value,buf,opretlen,txid,vout,symbol); + } } void komodo_event_undo(struct komodo_state *sp,struct komodo_event *ep) @@ -169,6 +178,7 @@ void komodo_eventadd_kmdheight(struct komodo_state *sp,char *symbol,int32_t heig } else { + //fprintf(stderr,"REWIND kmdheight.%d\n",kmdheight); kmdheight = -kmdheight; komodo_eventadd(sp,height,symbol,KOMODO_EVENT_REWIND,(uint8_t *)&height,sizeof(height)); if ( sp != 0 ) @@ -178,30 +188,30 @@ void komodo_eventadd_kmdheight(struct komodo_state *sp,char *symbol,int32_t heig /*void komodo_eventadd_deposit(int32_t actionflag,char *symbol,int32_t height,uint64_t komodoshis,char *fiat,uint64_t fiatoshis,uint8_t rmd160[20],bits256 kmdtxid,uint16_t kmdvout,uint64_t price) -{ - uint8_t opret[512]; uint16_t opretlen; - komodo_eventadd_opreturn(symbol,height,KOMODO_OPRETURN_DEPOSIT,kmdtxid,komodoshis,kmdvout,opret,opretlen); -} - -void komodo_eventadd_issued(int32_t actionflag,char *symbol,int32_t height,int32_t fiatheight,bits256 fiattxid,uint16_t fiatvout,bits256 kmdtxid,uint16_t kmdvout,uint64_t fiatoshis) -{ - uint8_t opret[512]; uint16_t opretlen; - komodo_eventadd_opreturn(symbol,height,KOMODO_OPRETURN_ISSUED,fiattxid,fiatoshis,fiatvout,opret,opretlen); -} - -void komodo_eventadd_withdraw(int32_t actionflag,char *symbol,int32_t height,uint64_t komodoshis,char *fiat,uint64_t fiatoshis,uint8_t rmd160[20],bits256 fiattxid,int32_t fiatvout,uint64_t price) -{ - uint8_t opret[512]; uint16_t opretlen; - komodo_eventadd_opreturn(symbol,height,KOMODO_OPRETURN_WITHDRAW,fiattxid,fiatoshis,fiatvout,opret,opretlen); -} - -void komodo_eventadd_redeemed(int32_t actionflag,char *symbol,int32_t height,bits256 kmdtxid,uint16_t kmdvout,int32_t fiatheight,bits256 fiattxid,uint16_t fiatvout,uint64_t komodoshis) -{ - uint8_t opret[512]; uint16_t opretlen; - komodo_eventadd_opreturn(symbol,height,KOMODO_OPRETURN_REDEEMED,kmdtxid,komodoshis,kmdvout,opret,opretlen); -}*/ + { + uint8_t opret[512]; uint16_t opretlen; + komodo_eventadd_opreturn(symbol,height,KOMODO_OPRETURN_DEPOSIT,kmdtxid,komodoshis,kmdvout,opret,opretlen); + } + + void komodo_eventadd_issued(int32_t actionflag,char *symbol,int32_t height,int32_t fiatheight,bits256 fiattxid,uint16_t fiatvout,bits256 kmdtxid,uint16_t kmdvout,uint64_t fiatoshis) + { + uint8_t opret[512]; uint16_t opretlen; + komodo_eventadd_opreturn(symbol,height,KOMODO_OPRETURN_ISSUED,fiattxid,fiatoshis,fiatvout,opret,opretlen); + } + + void komodo_eventadd_withdraw(int32_t actionflag,char *symbol,int32_t height,uint64_t komodoshis,char *fiat,uint64_t fiatoshis,uint8_t rmd160[20],bits256 fiattxid,int32_t fiatvout,uint64_t price) + { + uint8_t opret[512]; uint16_t opretlen; + komodo_eventadd_opreturn(symbol,height,KOMODO_OPRETURN_WITHDRAW,fiattxid,fiatoshis,fiatvout,opret,opretlen); + } + + void komodo_eventadd_redeemed(int32_t actionflag,char *symbol,int32_t height,bits256 kmdtxid,uint16_t kmdvout,int32_t fiatheight,bits256 fiattxid,uint16_t fiatvout,uint64_t komodoshis) + { + uint8_t opret[512]; uint16_t opretlen; + komodo_eventadd_opreturn(symbol,height,KOMODO_OPRETURN_REDEEMED,kmdtxid,komodoshis,kmdvout,opret,opretlen); + }*/ // process events -// +// #endif From ff89a2e7d692aa5d00b97291063472ca7614f667 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Apr 2018 15:58:34 +0300 Subject: [PATCH 46/49] Fix syntax --- src/komodo_events.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/komodo_events.h b/src/komodo_events.h index c64ccbaa2..30e745051 100644 --- a/src/komodo_events.h +++ b/src/komodo_events.h @@ -37,7 +37,7 @@ struct komodo_event *komodo_eventadd(struct komodo_state *sp,int32_t height,char return(ep); } -void komodo_eventadd_notarized(struct komodo_state *sp,char *symbol,int32_t height,char *dest,uint256 notarized_hash,uint256 notarized_desttxid,int32_t notarizedheight,uint256 MoM,int32_t MoMdepth) +void komodo_eventadd_notarized(struct komodo_state *sp,char *symbol,int32_t height,char *dest,uint256 notarized_hash,uint256 notarized_desttxid,int32_t notarizedheight)//,uint256 MoM,int32_t MoMdepth) { struct komodo_event_notarized N; if ( NOTARY_PUBKEY33[0] != 0 && komodo_verifynotarization(symbol,dest,height,notarizedheight,notarized_hash,notarized_desttxid) != 0 ) @@ -53,12 +53,12 @@ void komodo_eventadd_notarized(struct komodo_state *sp,char *symbol,int32_t heig N.blockhash = notarized_hash; N.desttxid = notarized_desttxid; N.notarizedheight = notarizedheight; - N.MoM = MoM; - N.MoMdepth = MoMdepth; + //N.MoM = MoM; + //N.MoMdepth = MoMdepth; strncpy(N.dest,dest,sizeof(N.dest)-1); komodo_eventadd(sp,height,symbol,KOMODO_EVENT_NOTARIZED,(uint8_t *)&N,sizeof(N)); if ( sp != 0 ) - komodo_notarized_update(sp,height,notarizedheight,notarized_hash,notarized_desttxid,MoM,MoMdepth); + komodo_notarized_update(sp,height,notarizedheight,notarized_hash,notarized_desttxid)//,MoM,MoMdepth); } } From c3e2036428ce80e7dc567384b80302174d718f9d Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Apr 2018 15:59:28 +0300 Subject: [PATCH 47/49] ; minor bug fix update --- src/komodo_events.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/komodo_events.h b/src/komodo_events.h index 30e745051..219d6e479 100644 --- a/src/komodo_events.h +++ b/src/komodo_events.h @@ -58,7 +58,7 @@ void komodo_eventadd_notarized(struct komodo_state *sp,char *symbol,int32_t heig strncpy(N.dest,dest,sizeof(N.dest)-1); komodo_eventadd(sp,height,symbol,KOMODO_EVENT_NOTARIZED,(uint8_t *)&N,sizeof(N)); if ( sp != 0 ) - komodo_notarized_update(sp,height,notarizedheight,notarized_hash,notarized_desttxid)//,MoM,MoMdepth); + komodo_notarized_update(sp,height,notarizedheight,notarized_hash,notarized_desttxid);//,MoM,MoMdepth); } } From 98dc898d4011f0ddbdce431c44bc9558b58e5bb5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Apr 2018 16:02:09 +0300 Subject: [PATCH 48/49] Remove printouts --- src/komodo.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/komodo.h b/src/komodo.h index 129ea3b5f..aba93c9e4 100644 --- a/src/komodo.h +++ b/src/komodo.h @@ -189,7 +189,7 @@ int32_t komodo_parsestatefile(struct komodo_state *sp,FILE *fp,char *symbol,char //printf("load pvals ht.%d numpvals.%d\n",ht,numpvals); } else printf("error loading pvals[%d]\n",numpvals); } - else printf("[%s] %s illegal func.(%d %c)\n",ASSETCHAINS_SYMBOL,symbol,func,func); + // else printf("[%s] %s illegal func.(%d %c)\n",ASSETCHAINS_SYMBOL,symbol,func,func); return(func); } else return(-1); } @@ -319,7 +319,7 @@ int32_t komodo_parsestatefiledata(struct komodo_state *sp,uint8_t *filedata,long //printf("load pvals ht.%d numpvals.%d\n",ht,numpvals); } else printf("error loading pvals[%d]\n",numpvals); } - else printf("[%s] %s illegal func.(%d %c)\n",ASSETCHAINS_SYMBOL,symbol,func,func); + // else printf("[%s] %s illegal func.(%d %c)\n",ASSETCHAINS_SYMBOL,symbol,func,func); *fposp = fpos; return(func); } From 8dc1322c41999b6d7975bbfb21d9d72cc030fd0a Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 14 Apr 2018 16:02:46 +0300 Subject: [PATCH 49/49] -printf --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 7061fa4eb..48324ca42 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3436,7 +3436,7 @@ bool AcceptBlockHeader(const CBlockHeader& block, CValidationState& state, CBloc if (!ContextualCheckBlockHeader(block, state, pindexPrev)) { pindex->nStatus |= BLOCK_FAILED_MASK; - fprintf(stderr,"known block.%d failing ContextualCheckBlockHeader\n",(int32_t)pindex->nHeight); + //fprintf(stderr,"known block.%d failing ContextualCheckBlockHeader\n",(int32_t)pindex->nHeight); return false; } }