From 95c463966ae35231a49f708c0b8465360de4b4de Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Feb 2018 22:25:37 +0200 Subject: [PATCH 01/13] Dont create .conf from cli --- src/bitcoin-cli.cpp | 1 + src/komodo_utils.h | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index cac650a00..253c49366 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -65,6 +65,7 @@ public: }; +#define FROM_CLI #include "uint256.h" #include "arith_uint256.h" diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 418a3225d..4b0521498 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1362,12 +1362,14 @@ void komodo_configfile(char *symbol,uint16_t port) #endif if ( (fp= fopen(fname,"rb")) == 0 ) { +#ifndef FROM_CLI if ( (fp= fopen(fname,"wb")) != 0 ) { 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); +#endif } else { @@ -1619,6 +1621,7 @@ void komodo_args(char *argv0) for (i=0; i<4; i++) sprintf(&magicstr[i<<1],"%02x",magic[i]); magicstr[8] = 0; +#ifndef FROM_CLI sprintf(fname,"gen%s",ASSETCHAINS_SYMBOL); if ( (fp= fopen(fname,"wb")) != 0 ) { @@ -1626,6 +1629,7 @@ void komodo_args(char *argv0) fclose(fp); //printf("created (%s)\n",fname); } else printf("error creating (%s)\n",fname); +#endif } else { From 0df0ed0c68d2c43ac5023bbb06834918b45d3d7f Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 4 Mar 2018 09:59:21 +0200 Subject: [PATCH 02/13] CLTV fprintf --- src/komodo_utils.h | 13 ------------- src/script/interpreter.cpp | 6 ++++++ 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 4b0521498..1270b3e55 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1444,19 +1444,6 @@ uint32_t komodo_assetmagic(char *symbol,uint64_t supply,uint8_t *extraptr,int32_ return(calc_crc32(crc0,buf,len)); } -/*int32_t komodo_shortflag(char *symbol) -{ - int32_t i,shortflag = 0; - if ( symbol[0] == '-' ) - { - shortflag = 1; - for (i=0; symbol[i+1]!=0; i++) - symbol[i] = symbol[i+1]; - symbol[i] = 0; - } - return(shortflag); -}*/ - uint16_t komodo_assetport(uint32_t magic,int32_t extralen) { if ( magic == 0x8de4eef9 ) diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp index 6c17eab70..1059cb74d 100644 --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -1129,7 +1129,10 @@ bool TransactionSignatureChecker::CheckLockTime(const CScriptNum& nLockTime) con // Now that we know we're comparing apples-to-apples, the // comparison is a simple numeric one. if (nLockTime > (int64_t)txTo->nLockTime) + { + fprintf(stderr,"CLTV error: nLockTime %u > %u txTo->nLockTime\n",(uint32_t)nLockTime,(uint32_t)txTo->nLockTime); return false; + } // Finally the nLockTime feature can be disabled and thus // CHECKLOCKTIMEVERIFY bypassed if every txin has been @@ -1142,7 +1145,10 @@ bool TransactionSignatureChecker::CheckLockTime(const CScriptNum& nLockTime) con // inputs, but testing just this input minimizes the data // required to prove correct CHECKLOCKTIMEVERIFY execution. if (txTo->vin[nIn].IsFinal()) + { + fprintf(stderr,"CLTV error: nonfinal vin.%d\n",(int32_t)nIn); return false; + } return true; } From 5968c21549003e94c017b33eba03c7d43a748238 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 4 Mar 2018 10:01:29 +0200 Subject: [PATCH 03/13] Test --- src/script/interpreter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp index 1059cb74d..632c954af 100644 --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -1130,7 +1130,7 @@ bool TransactionSignatureChecker::CheckLockTime(const CScriptNum& nLockTime) con // comparison is a simple numeric one. if (nLockTime > (int64_t)txTo->nLockTime) { - fprintf(stderr,"CLTV error: nLockTime %u > %u txTo->nLockTime\n",(uint32_t)nLockTime,(uint32_t)txTo->nLockTime); + fprintf(stderr,"CLTV error: nLockTime %u > %u txTo->nLockTime\n",(uint32_t)(int64_t)nLockTime,(uint32_t)txTo->nLockTime); return false; } From fbdd7dde3310dac3ddba111caf99fc35f93f772d Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 4 Mar 2018 10:02:44 +0200 Subject: [PATCH 04/13] Test --- src/script/interpreter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp index 632c954af..52ec4f899 100644 --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -1130,7 +1130,7 @@ bool TransactionSignatureChecker::CheckLockTime(const CScriptNum& nLockTime) con // comparison is a simple numeric one. if (nLockTime > (int64_t)txTo->nLockTime) { - fprintf(stderr,"CLTV error: nLockTime %u > %u txTo->nLockTime\n",(uint32_t)(int64_t)nLockTime,(uint32_t)txTo->nLockTime); + fprintf(stderr,"CLTV error: nLockTime %llu > %u txTo->nLockTime\n",nLockTime,(uint32_t)txTo->nLockTime); return false; } From 67a9ed29aeae5e42e323b3d3220201607fbff5be Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 4 Mar 2018 10:03:13 +0200 Subject: [PATCH 05/13] Test --- src/script/interpreter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp index 52ec4f899..dccb4450a 100644 --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -1130,7 +1130,7 @@ bool TransactionSignatureChecker::CheckLockTime(const CScriptNum& nLockTime) con // comparison is a simple numeric one. if (nLockTime > (int64_t)txTo->nLockTime) { - fprintf(stderr,"CLTV error: nLockTime %llu > %u txTo->nLockTime\n",nLockTime,(uint32_t)txTo->nLockTime); + fprintf(stderr,"CLTV error: nLockTime %llu > %u txTo->nLockTime\n",(long long)nLockTime,(uint32_t)txTo->nLockTime); return false; } From ff4e7f86727ee3362da176161bfe67a2ee9de209 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 4 Mar 2018 10:03:55 +0200 Subject: [PATCH 06/13] Test --- src/script/interpreter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp index dccb4450a..52ec4f899 100644 --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -1130,7 +1130,7 @@ bool TransactionSignatureChecker::CheckLockTime(const CScriptNum& nLockTime) con // comparison is a simple numeric one. if (nLockTime > (int64_t)txTo->nLockTime) { - fprintf(stderr,"CLTV error: nLockTime %llu > %u txTo->nLockTime\n",(long long)nLockTime,(uint32_t)txTo->nLockTime); + fprintf(stderr,"CLTV error: nLockTime %llu > %u txTo->nLockTime\n",nLockTime,(uint32_t)txTo->nLockTime); return false; } From b9dddf15c4b91896a69c0ad42e887ba64fb6a196 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 4 Mar 2018 10:07:57 +0200 Subject: [PATCH 07/13] Test --- src/script/interpreter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp index 52ec4f899..a4deae8cf 100644 --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -1130,7 +1130,7 @@ bool TransactionSignatureChecker::CheckLockTime(const CScriptNum& nLockTime) con // comparison is a simple numeric one. if (nLockTime > (int64_t)txTo->nLockTime) { - fprintf(stderr,"CLTV error: nLockTime %llu > %u txTo->nLockTime\n",nLockTime,(uint32_t)txTo->nLockTime); + //fprintf(stderr,"CLTV error: nLockTime %llu > %u txTo->nLockTime\n",nLockTime,(uint32_t)txTo->nLockTime); return false; } @@ -1146,7 +1146,7 @@ bool TransactionSignatureChecker::CheckLockTime(const CScriptNum& nLockTime) con // required to prove correct CHECKLOCKTIMEVERIFY execution. if (txTo->vin[nIn].IsFinal()) { - fprintf(stderr,"CLTV error: nonfinal vin.%d\n",(int32_t)nIn); + fprintf(stderr,"CLTV error: nonfinal vin.%d nSequence.%u\n",(int32_t)nIn,(uint32_t)txTo->vin[nIn].nSequence); return false; } From f8f7a4d4cd41ed51f84e25dbb67c8acbee307fbc Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 4 Mar 2018 10:11:12 +0200 Subject: [PATCH 08/13] Test --- src/script/interpreter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp index a4deae8cf..52e788496 100644 --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -1146,7 +1146,7 @@ bool TransactionSignatureChecker::CheckLockTime(const CScriptNum& nLockTime) con // required to prove correct CHECKLOCKTIMEVERIFY execution. if (txTo->vin[nIn].IsFinal()) { - fprintf(stderr,"CLTV error: nonfinal vin.%d nSequence.%u\n",(int32_t)nIn,(uint32_t)txTo->vin[nIn].nSequence); + //fprintf(stderr,"CLTV error: nonfinal vin.%d nSequence.%u vs %u\n",(int32_t)nIn,(uint32_t)txTo->vin[nIn].nSequence,(uint32_t)std::numeric_limits::max()); return false; } From 7c5999c9f0a45329fcde1c1be069797c276f8b35 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 4 Mar 2018 10:21:33 +0200 Subject: [PATCH 09/13] Prints --- src/script/interpreter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp index 52e788496..cd0f5eaf3 100644 --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -1130,7 +1130,7 @@ bool TransactionSignatureChecker::CheckLockTime(const CScriptNum& nLockTime) con // comparison is a simple numeric one. if (nLockTime > (int64_t)txTo->nLockTime) { - //fprintf(stderr,"CLTV error: nLockTime %llu > %u txTo->nLockTime\n",nLockTime,(uint32_t)txTo->nLockTime); + fprintf(stderr,"CLTV error: nLockTime %llu > %u txTo->nLockTime\n",nLockTime,(uint32_t)txTo->nLockTime); return false; } @@ -1146,7 +1146,7 @@ bool TransactionSignatureChecker::CheckLockTime(const CScriptNum& nLockTime) con // required to prove correct CHECKLOCKTIMEVERIFY execution. if (txTo->vin[nIn].IsFinal()) { - //fprintf(stderr,"CLTV error: nonfinal vin.%d nSequence.%u vs %u\n",(int32_t)nIn,(uint32_t)txTo->vin[nIn].nSequence,(uint32_t)std::numeric_limits::max()); + fprintf(stderr,"CLTV error: nonfinal vin.%d nSequence.%u vs %u\n",(int32_t)nIn,(uint32_t)txTo->vin[nIn].nSequence,(uint32_t)std::numeric_limits::max()); return false; } From 7fbab03f7363bd6881dbf957879e8b20b96a242f Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 4 Mar 2018 10:23:36 +0200 Subject: [PATCH 10/13] Test --- src/script/interpreter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp index cd0f5eaf3..10915d2ee 100644 --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -1130,7 +1130,7 @@ bool TransactionSignatureChecker::CheckLockTime(const CScriptNum& nLockTime) con // comparison is a simple numeric one. if (nLockTime > (int64_t)txTo->nLockTime) { - fprintf(stderr,"CLTV error: nLockTime %llu > %u txTo->nLockTime\n",nLockTime,(uint32_t)txTo->nLockTime); + fprintf(stderr,"CLTV error: nLockTime %llu > %u txTo->nLockTime\n",*(long long *)&nLockTime,(uint32_t)txTo->nLockTime); return false; } From 2458b054ecf026204e1110ae8448d0aef4974cdc Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 4 Mar 2018 10:36:35 +0200 Subject: [PATCH 11/13] Test --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index a52fd3f02..4277beabd 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -737,7 +737,7 @@ bool IsFinalTx(const CTransaction &tx, int nBlockHeight, int64_t nBlockTime) } else if (!txin.IsFinal()) { - //printf("non-final txin seq.%x locktime.%u vs nTime.%u\n",txin.nSequence,(uint32_t)tx.nLockTime,(uint32_t)nBlockTime); + printf("non-final txin seq.%x locktime.%u vs nTime.%u\n",txin.nSequence,(uint32_t)tx.nLockTime,(uint32_t)nBlockTime); return false; } } From ff0e23d17e83d58de02f64ad56f87c985db75113 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sun, 4 Mar 2018 10:39:54 +0200 Subject: [PATCH 12/13] Test --- src/script/interpreter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp index 10915d2ee..1e236634a 100644 --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -1130,7 +1130,7 @@ bool TransactionSignatureChecker::CheckLockTime(const CScriptNum& nLockTime) con // comparison is a simple numeric one. if (nLockTime > (int64_t)txTo->nLockTime) { - fprintf(stderr,"CLTV error: nLockTime %llu > %u txTo->nLockTime\n",*(long long *)&nLockTime,(uint32_t)txTo->nLockTime); + //fprintf(stderr,"CLTV error: nLockTime %llu > %u txTo->nLockTime\n",*(long long *)&nLockTime,(uint32_t)txTo->nLockTime); return false; } @@ -1146,7 +1146,7 @@ bool TransactionSignatureChecker::CheckLockTime(const CScriptNum& nLockTime) con // required to prove correct CHECKLOCKTIMEVERIFY execution. if (txTo->vin[nIn].IsFinal()) { - fprintf(stderr,"CLTV error: nonfinal vin.%d nSequence.%u vs %u\n",(int32_t)nIn,(uint32_t)txTo->vin[nIn].nSequence,(uint32_t)std::numeric_limits::max()); + //fprintf(stderr,"CLTV error: nonfinal vin.%d nSequence.%u vs %u\n",(int32_t)nIn,(uint32_t)txTo->vin[nIn].nSequence,(uint32_t)std::numeric_limits::max()); return false; } From 47ca6eb3c2f1ad9e87d2e2cfda33840f6e73eb85 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 5 Mar 2018 10:23:01 +0200 Subject: [PATCH 13/13] Remove -Werror to allow compile on more OS variants --- zcutil/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zcutil/build.sh b/zcutil/build.sh index 2e3837f3a..f789c7a8d 100755 --- a/zcutil/build.sh +++ b/zcutil/build.sh @@ -88,5 +88,5 @@ PREFIX="$(pwd)/depends/$BUILD/" HOST="$HOST" BUILD="$BUILD" NO_RUST="$RUST_ARG" "$MAKE" "$@" -C ./depends/ V=1 ./autogen.sh -CC="$CC" CXX="$CXX" ./configure --prefix="${PREFIX}" --host="$HOST" --build="$BUILD" "$RUST_ARG" "$HARDENING_ARG" "$LCOV_ARG" "$TEST_ARG" "$MINING_ARG" CXXFLAGS='-fwrapv -fno-strict-aliasing -Werror -g' +CC="$CC" CXX="$CXX" ./configure --prefix="${PREFIX}" --host="$HOST" --build="$BUILD" "$RUST_ARG" "$HARDENING_ARG" "$LCOV_ARG" "$TEST_ARG" "$MINING_ARG" CXXFLAGS='-fwrapv -fno-strict-aliasing -g' "$MAKE" "$@" V=1