From af24220ba745fc7769f81ffb96927268dcf6d8ef Mon Sep 17 00:00:00 2001 From: jl777 Date: Fri, 14 Dec 2018 15:53:37 -1100 Subject: [PATCH 01/31] Notary port -> 7775 --- src/main.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 788ee95b0..80eb63853 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3879,9 +3879,7 @@ int32_t komodo_activate_sapling(CBlockIndex *pindex) } if ( activation != 0 ) { -//#if KOMODO_SAPLING_ACTIVATION != 1544832000 komodo_setactivation(activation); -//#endif fprintf(stderr,"%s sapling activation at %d\n",ASSETCHAINS_SYMBOL,activation); ASSETCHAINS_SAPLING = activation; } From 8cee58f02d2135bf96033eff7b1c89c75b0c4011 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 15 Dec 2018 01:06:07 -1100 Subject: [PATCH 02/31] +print --- src/cc/dapps/zmigrate.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cc/dapps/zmigrate.c b/src/cc/dapps/zmigrate.c index a86b529ad..249a3edce 100644 --- a/src/cc/dapps/zmigrate.c +++ b/src/cc/dapps/zmigrate.c @@ -734,6 +734,7 @@ int32_t z_sendmany(char *opidstr,char *coinstr,char *acname,char *srcaddr,char * cJSON *retjson; char *retstr,params[1024],addr[128]; sprintf(params,"'[{\"address\":\"%s\",\"amount\":%.8f}]'",destaddr,dstr(amount)); sprintf(addr,"\"%s\"",srcaddr); + printf("z_sendmany from.(%s) -> %s\n",srcaddr,params); if ( (retjson= get_komodocli(coinstr,&retstr,acname,"z_sendmany",addr,params,"","")) != 0 ) { printf("unexpected json z_sendmany.(%s)\n",jprint(retjson,0)); From 3f6462aa16e97e6e1ba867ad3a07dea01fd21a2b Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 15 Dec 2018 01:08:39 -1100 Subject: [PATCH 03/31] +prints --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 80eb63853..13268fe1b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1446,8 +1446,8 @@ bool CheckTransactionWithoutProofVerification(uint32_t tiptime,const CTransactio if ( ASSETCHAINS_PRIVATE != 0 && invalid_private_taddr != 0 ) { static uint32_t counter; - if ( counter++ < 10 ) - fprintf(stderr,"found taddr in private chain: z_z.%d z_t.%d t_z.%d\n",z_z,z_t,t_z); + //if ( counter++ < 10 ) + fprintf(stderr,"found taddr in private chain: z_z.%d z_t.%d t_z.%d vinsize.%d\n",z_z,z_t,t_z,(int32_t)tx.vin.size()); if ( z_t == 0 || z_z != 0 || t_z != 0 || tx.vin.size() != 0 ) return state.DoS(100, error("CheckTransaction(): this is a private chain, only sprout -> taddr allowed until deadline"),REJECT_INVALID, "bad-txns-acprivacy-chain"); } From 77557116e7529c1174e1f62be68b3b2e518b5873 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 15 Dec 2018 01:10:19 -1100 Subject: [PATCH 04/31] Smaller size --- src/cc/dapps/zmigrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc/dapps/zmigrate.c b/src/cc/dapps/zmigrate.c index 249a3edce..4b29bebaf 100644 --- a/src/cc/dapps/zmigrate.c +++ b/src/cc/dapps/zmigrate.c @@ -907,7 +907,7 @@ int32_t main(int32_t argc,char **argv) zsaddr = clonestr(argv[2]); printf("%s: %s %s\n",REFCOIN_CLI,coinstr,zsaddr); uint32_t lastopid; char coinaddr[64],zcaddr[128],opidstr[128]; int32_t finished; int64_t amount,stdamount,txfee; - stdamount = 1000 * SATOSHIDEN; + stdamount = 100 * SATOSHIDEN; txfee = 10000; again: printf("start processing zmigrate\n"); From f6a3cd1a18a74f38426ea05cf2319369966532a5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 15 Dec 2018 01:13:59 -1100 Subject: [PATCH 05/31] Randomize zmigrate size 100/1000/10000 --- src/cc/dapps/zmigrate.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/cc/dapps/zmigrate.c b/src/cc/dapps/zmigrate.c index 4b29bebaf..2a6249110 100644 --- a/src/cc/dapps/zmigrate.c +++ b/src/cc/dapps/zmigrate.c @@ -931,6 +931,12 @@ again: if ( (amount= find_sprout_amount(coinstr,zcaddr)) > txfee ) { // generate taddr, send max of 10000.0001 + switch ( (rand() % 3) ) + { + case 0: stdamount = 100 * SATOSHIDEN; break; + case 1: stdamount = 1000 * SATOSHIDEN; break; + case 2: stdamount = 10000 * SATOSHIDEN; break; + } if ( amount > stdamount+txfee ) amount = stdamount + txfee; if ( getnewaddress(coinaddr,coinstr,"") == 0 ) From 8bcefc7c96a2348060cb668762bd5e836ca38904 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 15 Dec 2018 01:18:56 -1100 Subject: [PATCH 06/31] Rotate --- src/cc/dapps/zmigrate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cc/dapps/zmigrate.c b/src/cc/dapps/zmigrate.c index 2a6249110..2ab95abe3 100644 --- a/src/cc/dapps/zmigrate.c +++ b/src/cc/dapps/zmigrate.c @@ -931,7 +931,8 @@ again: if ( (amount= find_sprout_amount(coinstr,zcaddr)) > txfee ) { // generate taddr, send max of 10000.0001 - switch ( (rand() % 3) ) + static uint32_t counter; + switch ( (counter++ % 3) ) { case 0: stdamount = 100 * SATOSHIDEN; break; case 1: stdamount = 1000 * SATOSHIDEN; break; From 441aa51c8b6de2f04ed0c5355bdbb28d489c4aef Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 15 Dec 2018 01:22:02 -1100 Subject: [PATCH 07/31] Smaller cap --- src/cc/dapps/zmigrate.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/cc/dapps/zmigrate.c b/src/cc/dapps/zmigrate.c index 2ab95abe3..4b29bebaf 100644 --- a/src/cc/dapps/zmigrate.c +++ b/src/cc/dapps/zmigrate.c @@ -931,13 +931,6 @@ again: if ( (amount= find_sprout_amount(coinstr,zcaddr)) > txfee ) { // generate taddr, send max of 10000.0001 - static uint32_t counter; - switch ( (counter++ % 3) ) - { - case 0: stdamount = 100 * SATOSHIDEN; break; - case 1: stdamount = 1000 * SATOSHIDEN; break; - case 2: stdamount = 10000 * SATOSHIDEN; break; - } if ( amount > stdamount+txfee ) amount = stdamount + txfee; if ( getnewaddress(coinaddr,coinstr,"") == 0 ) From 3e03c53eb77c3ce44a46ddd6f8c131704ec350db Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 15 Dec 2018 01:27:11 -1100 Subject: [PATCH 08/31] +print --- src/cc/dapps/zmigrate.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cc/dapps/zmigrate.c b/src/cc/dapps/zmigrate.c index 4b29bebaf..78749ec68 100644 --- a/src/cc/dapps/zmigrate.c +++ b/src/cc/dapps/zmigrate.c @@ -670,6 +670,7 @@ int64_t find_onetime_amount(char *coinstr,char *coinaddr) coinaddr[0] = 0; if ( (array= get_listunspent(coinstr,"")) != 0 ) { + printf("got listunspent.(%s)\n",jprint(array,0)); if ( (n= cJSON_GetArraySize(array)) > 0 ) { for (i=0; i Date: Sat, 15 Dec 2018 01:28:49 -1100 Subject: [PATCH 09/31] +print --- src/cc/dapps/zmigrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc/dapps/zmigrate.c b/src/cc/dapps/zmigrate.c index 78749ec68..6736bc577 100644 --- a/src/cc/dapps/zmigrate.c +++ b/src/cc/dapps/zmigrate.c @@ -326,7 +326,7 @@ cJSON *get_komodocli(char *refcoin,char **retstrp,char *acname,char *method,char else if ( REFCOIN_CLI != 0 && REFCOIN_CLI[0] != 0 ) { sprintf(cmdstr,"%s %s %s %s %s %s > %s\n",REFCOIN_CLI,method,arg0,arg1,arg2,arg3,fname); - //printf("ref.(%s) REFCOIN_CLI (%s)\n",refcoin,cmdstr); + printf("ref.(%s) REFCOIN_CLI (%s)\n",refcoin,cmdstr); } system(cmdstr); *retstrp = 0; From 8b16e9a503cdb79b33529046c69077c6903c61b1 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 15 Dec 2018 01:30:09 -1100 Subject: [PATCH 10/31] -print --- src/cc/dapps/zmigrate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cc/dapps/zmigrate.c b/src/cc/dapps/zmigrate.c index 6736bc577..1d5355790 100644 --- a/src/cc/dapps/zmigrate.c +++ b/src/cc/dapps/zmigrate.c @@ -326,7 +326,7 @@ cJSON *get_komodocli(char *refcoin,char **retstrp,char *acname,char *method,char else if ( REFCOIN_CLI != 0 && REFCOIN_CLI[0] != 0 ) { sprintf(cmdstr,"%s %s %s %s %s %s > %s\n",REFCOIN_CLI,method,arg0,arg1,arg2,arg3,fname); - printf("ref.(%s) REFCOIN_CLI (%s)\n",refcoin,cmdstr); + //printf("ref.(%s) REFCOIN_CLI (%s)\n",refcoin,cmdstr); } system(cmdstr); *retstrp = 0; @@ -670,7 +670,7 @@ int64_t find_onetime_amount(char *coinstr,char *coinaddr) coinaddr[0] = 0; if ( (array= get_listunspent(coinstr,"")) != 0 ) { - printf("got listunspent.(%s)\n",jprint(array,0)); + //printf("got listunspent.(%s)\n",jprint(array,0)); if ( (n= cJSON_GetArraySize(array)) > 0 ) { for (i=0; i Date: Sat, 15 Dec 2018 01:33:11 -1100 Subject: [PATCH 11/31] Speedup --- src/cc/dapps/zmigrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc/dapps/zmigrate.c b/src/cc/dapps/zmigrate.c index 1d5355790..d1f09db70 100644 --- a/src/cc/dapps/zmigrate.c +++ b/src/cc/dapps/zmigrate.c @@ -939,7 +939,7 @@ again: z_sendmany(opidstr,coinstr,"",zcaddr,coinaddr,amount-txfee); lastopid = (uint32_t)time(NULL); } else printf("couldnt getnewaddress!\n"); - sleep(30); + sleep(3); continue; } if ( time(NULL) > lastopid+600 ) From 7a0c4015b943f8ef6d31927d997acb9fc3a4552d Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 15 Dec 2018 01:34:28 -1100 Subject: [PATCH 12/31] Reduce delay --- src/cc/dapps/zmigrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc/dapps/zmigrate.c b/src/cc/dapps/zmigrate.c index d1f09db70..143c09d7f 100644 --- a/src/cc/dapps/zmigrate.c +++ b/src/cc/dapps/zmigrate.c @@ -918,7 +918,7 @@ again: { if ( have_pending_opid(coinstr,0) != 0 ) { - sleep(60); + sleep(10); continue; } if ( (amount= find_onetime_amount(coinstr,coinaddr)) > txfee ) From e4774f0590d62b4a751d197c72d1c2b877a90aec Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 15 Dec 2018 01:41:22 -1100 Subject: [PATCH 13/31] Try 500 --- src/cc/dapps/zmigrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc/dapps/zmigrate.c b/src/cc/dapps/zmigrate.c index 143c09d7f..48542d2cc 100644 --- a/src/cc/dapps/zmigrate.c +++ b/src/cc/dapps/zmigrate.c @@ -908,7 +908,7 @@ int32_t main(int32_t argc,char **argv) zsaddr = clonestr(argv[2]); printf("%s: %s %s\n",REFCOIN_CLI,coinstr,zsaddr); uint32_t lastopid; char coinaddr[64],zcaddr[128],opidstr[128]; int32_t finished; int64_t amount,stdamount,txfee; - stdamount = 100 * SATOSHIDEN; + stdamount = 500 * SATOSHIDEN; txfee = 10000; again: printf("start processing zmigrate\n"); From b2d6cfe7bf70bad0fef827b4a43813a61059d188 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 15 Dec 2018 02:32:42 -1100 Subject: [PATCH 14/31] -print --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 13268fe1b..2f710af5d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1446,7 +1446,7 @@ bool CheckTransactionWithoutProofVerification(uint32_t tiptime,const CTransactio if ( ASSETCHAINS_PRIVATE != 0 && invalid_private_taddr != 0 ) { static uint32_t counter; - //if ( counter++ < 10 ) + if ( counter++ < 10 ) fprintf(stderr,"found taddr in private chain: z_z.%d z_t.%d t_z.%d vinsize.%d\n",z_z,z_t,t_z,(int32_t)tx.vin.size()); if ( z_t == 0 || z_z != 0 || t_z != 0 || tx.vin.size() != 0 ) return state.DoS(100, error("CheckTransaction(): this is a private chain, only sprout -> taddr allowed until deadline"),REJECT_INVALID, "bad-txns-acprivacy-chain"); From dd0fc6a3bce87e9e260a6ff3d447c6e9c64c20d3 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 15 Dec 2018 02:52:35 -1100 Subject: [PATCH 15/31] Dont reject peer with tx overwinter mismatch --- src/main.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 2f710af5d..e606a2667 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1020,10 +1020,8 @@ bool ContextualCheckTransaction( // If Sprout rules apply, reject transactions which are intended for Overwinter and beyond if (isSprout && tx.fOverwintered) { - return state.DoS(isInitBlockDownload() ? 0 : dosLevel, - error("ContextualCheckTransaction(): ht.%d activates.%d dosLevel.%d overwinter is not active yet", - nHeight, Params().GetConsensus().vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight, dosLevel), - REJECT_INVALID, "tx-overwinter-not-active"); + return state.DoS(nHeight < Params().GetConsensus().vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight ? 0 : dosLevel,error("ContextualCheckTransaction(): ht.%d activates.%d dosLevel.%d overwinter is not active yet",nHeight, Params().GetConsensus().vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight, dosLevel),REJECT_INVALID, "tx-overwinter-not-active"); + //return state.DoS(isInitBlockDownload() ? 0 : dosLevel,error("ContextualCheckTransaction(): ht.%d activates.%d dosLevel.%d overwinter is not active yet",nHeight, Params().GetConsensus().vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight, dosLevel),REJECT_INVALID, "tx-overwinter-not-active"); } if (saplingActive) { From faec23f3687eff8a531a93ecbb1490f37f816b82 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 15 Dec 2018 02:59:45 -1100 Subject: [PATCH 16/31] New PIRATE seed node --- src/assetchains.old | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assetchains.old b/src/assetchains.old index c1419e7f5..6df854903 100755 --- a/src/assetchains.old +++ b/src/assetchains.old @@ -39,7 +39,7 @@ echo $pubkey ~/VerusCoin/src/komodod -pubkey=$pubkey -ac_name=VRSC -ac_algo=verushash -ac_cc=1 -ac_veruspos=50 -ac_supply=0 -ac_eras=3 -ac_reward=0,38400000000,2400000000 -ac_halving=1,43200,1051920 -ac_decay=100000000,0,0 -ac_end=10080,226080,0 -ac_timelockgte=19200000000 -ac_timeunlockfrom=129600 -ac_timeunlockto=1180800 -addnode=185.25.48.236 -addnode=185.64.105.111 & ./komodod -pubkey=$pubkey -ac_name=SEC -ac_cc=333 -ac_supply=1000000000 -addnode=185.148.145.43 & ./komodod -pubkey=$pubkey -ac_name=CCL -ac_supply=200000000 -ac_end=1 -ac_cc=2 -addressindex=1 -spentindex=1 -addnode=142.93.136.89 -addnode=195.201.22.89 & -./komodod -pubkey=$pubkey -ac_name=PIRATE -ac_supply=0 -ac_reward=25600000000 -ac_halving=77777 -ac_private=1 -addnode=136.243.102.225 & +./komodod -pubkey=$pubkey -ac_name=PIRATE -ac_supply=0 -ac_reward=25600000000 -ac_halving=77777 -ac_private=1 -addnode=178.63.77.56 & ./komodod -pubkey=$pubkey -ac_name=MGNX -ac_supply=12465003 -ac_staked=90 -ac_reward=2000000000 -ac_halving=525960 -ac_cc=2 -ac_end=2629800 -addnode=142.93.27.180 & ./komodod -pubkey=$pubkey -ac_name=PGT -ac_supply=10000000 -ac_end=1 -addnode=190.114.254.104 & ./komodod -pubkey=$pubkey -ac_name=KMDICE -ac_supply=10500000 -ac_reward=2500000000 -ac_halving=210000 -ac_cc=2 -addressindex=1 -spentindex=1 -addnode=144.76.217.232 & From ea5cd9f31b948f8ee2b58b451e97bb75bf30031b Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 15 Dec 2018 03:02:56 -1100 Subject: [PATCH 17/31] Autoscale down size of std amount --- src/cc/dapps/zmigrate.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/cc/dapps/zmigrate.c b/src/cc/dapps/zmigrate.c index 48542d2cc..4d7e89ad6 100644 --- a/src/cc/dapps/zmigrate.c +++ b/src/cc/dapps/zmigrate.c @@ -932,6 +932,12 @@ again: if ( (amount= find_sprout_amount(coinstr,zcaddr)) > txfee ) { // generate taddr, send max of 10000.0001 + static int64_t lastamount,lastamount2; + stdamount = 500 * SATOSHIDEN; + if ( amount == lastamount && amount == lastamount2 ) + stdamount /= 10; + lastamount2 = lastamount; + lastamount = amount; if ( amount > stdamount+txfee ) amount = stdamount + txfee; if ( getnewaddress(coinaddr,coinstr,"") == 0 ) From dabdd01bec1a89bbbdff8288fec3565da6013758 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 15 Dec 2018 03:03:33 -1100 Subject: [PATCH 18/31] +comment --- src/cc/dapps/zmigrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc/dapps/zmigrate.c b/src/cc/dapps/zmigrate.c index 4d7e89ad6..620130306 100644 --- a/src/cc/dapps/zmigrate.c +++ b/src/cc/dapps/zmigrate.c @@ -908,7 +908,7 @@ int32_t main(int32_t argc,char **argv) zsaddr = clonestr(argv[2]); printf("%s: %s %s\n",REFCOIN_CLI,coinstr,zsaddr); uint32_t lastopid; char coinaddr[64],zcaddr[128],opidstr[128]; int32_t finished; int64_t amount,stdamount,txfee; - stdamount = 500 * SATOSHIDEN; + //stdamount = 500 * SATOSHIDEN; txfee = 10000; again: printf("start processing zmigrate\n"); From 151645ce9e89c9a6ff2d11d69b536816cad971a5 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 15 Dec 2018 03:16:43 -1100 Subject: [PATCH 19/31] 10/50/500 zmigrate sizes auto set --- src/cc/dapps/zmigrate.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/cc/dapps/zmigrate.c b/src/cc/dapps/zmigrate.c index 620130306..73bff3276 100644 --- a/src/cc/dapps/zmigrate.c +++ b/src/cc/dapps/zmigrate.c @@ -932,10 +932,16 @@ again: if ( (amount= find_sprout_amount(coinstr,zcaddr)) > txfee ) { // generate taddr, send max of 10000.0001 - static int64_t lastamount,lastamount2; + static int64_t lastamount,lastamount2,lastamount3,lastamount4; stdamount = 500 * SATOSHIDEN; if ( amount == lastamount && amount == lastamount2 ) + { stdamount /= 10; + if ( amount == lastamount3 && amount == lastamount4 ) + stdamount /= 5; + } + lastamount4 = lastamount3; + lastamount3 = lastamount2; lastamount2 = lastamount; lastamount = amount; if ( amount > stdamount+txfee ) From 2546ae048d93834f0887822d321df1f9c595c392 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 15 Dec 2018 03:25:41 -1100 Subject: [PATCH 20/31] Use height check for overwinter invalid --- src/main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index e606a2667..84abe0880 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1020,7 +1020,8 @@ bool ContextualCheckTransaction( // If Sprout rules apply, reject transactions which are intended for Overwinter and beyond if (isSprout && tx.fOverwintered) { - return state.DoS(nHeight < Params().GetConsensus().vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight ? 0 : dosLevel,error("ContextualCheckTransaction(): ht.%d activates.%d dosLevel.%d overwinter is not active yet",nHeight, Params().GetConsensus().vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight, dosLevel),REJECT_INVALID, "tx-overwinter-not-active"); + int32_t ht = Params().GetConsensus().vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight; + return state.DoS((ht < 0 || nHeight < ht) ? 0 : dosLevel,error("ContextualCheckTransaction(): ht.%d activates.%d dosLevel.%d overwinter is not active yet",nHeight, Params().GetConsensus().vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight, dosLevel),REJECT_INVALID, "tx-overwinter-not-active"); //return state.DoS(isInitBlockDownload() ? 0 : dosLevel,error("ContextualCheckTransaction(): ht.%d activates.%d dosLevel.%d overwinter is not active yet",nHeight, Params().GetConsensus().vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight, dosLevel),REJECT_INVALID, "tx-overwinter-not-active"); } From 9dceacbde87394c92b2bb5b7ee3eda941dae5bef Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 15 Dec 2018 04:57:12 -1100 Subject: [PATCH 21/31] Allow sprout when overwinter --- src/main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 84abe0880..c3fc62233 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1079,7 +1079,9 @@ bool ContextualCheckTransaction( if (overwinterActive) { // Reject transactions intended for Sprout if (!tx.fOverwintered) { - return state.DoS(dosLevel, error("ContextualCheckTransaction: overwinter is active"), + int32_t ht = Params().GetConsensus().vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight; + return state.DoS( + return state.DoS((ht < 0 || nHeight < ht) ? 0 : dosLevel, error("ContextualCheckTransaction: overwinter is active"), REJECT_INVALID, "tx-overwinter-active"); } From 2532131a6aab6d4812c2aac14b0947c8147e376d Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 15 Dec 2018 04:58:36 -1100 Subject: [PATCH 22/31] Syntax --- src/main.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index c3fc62233..e4a9d04c3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1080,9 +1080,7 @@ bool ContextualCheckTransaction( // Reject transactions intended for Sprout if (!tx.fOverwintered) { int32_t ht = Params().GetConsensus().vUpgrades[Consensus::UPGRADE_OVERWINTER].nActivationHeight; - return state.DoS( - return state.DoS((ht < 0 || nHeight < ht) ? 0 : dosLevel, error("ContextualCheckTransaction: overwinter is active"), - REJECT_INVALID, "tx-overwinter-active"); + return state.DoS((ht < 0 || nHeight < ht) ? 0 : dosLevel, error("ContextualCheckTransaction: overwinter is active"),REJECT_INVALID, "tx-overwinter-active"); } // Check that all transactions are unexpired From 69b8e1028d08230dd44e4d897909495e626137eb Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 15 Dec 2018 05:51:40 -1100 Subject: [PATCH 23/31] Dont retry failed bigger amounts in migrate --- src/cc/dapps/zmigrate.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cc/dapps/zmigrate.c b/src/cc/dapps/zmigrate.c index 73bff3276..42e7d0fe5 100644 --- a/src/cc/dapps/zmigrate.c +++ b/src/cc/dapps/zmigrate.c @@ -932,7 +932,7 @@ again: if ( (amount= find_sprout_amount(coinstr,zcaddr)) > txfee ) { // generate taddr, send max of 10000.0001 - static int64_t lastamount,lastamount2,lastamount3,lastamount4; + static int64_t lastamount,lastamount2,lastamount3,lastamount4,refamount = 500 * SATOSHIDEN; stdamount = 500 * SATOSHIDEN; if ( amount == lastamount && amount == lastamount2 ) { @@ -940,6 +940,10 @@ again: if ( amount == lastamount3 && amount == lastamount4 ) stdamount /= 5; } + if ( stdamount < refamount ) + refamount = stdamount; + else if ( refamount > stdamount ) + stdamount = refamount; lastamount4 = lastamount3; lastamount3 = lastamount2; lastamount2 = lastamount; From 3eb0194063c4e23c6b423193a5e4e790c6d8cf92 Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 15 Dec 2018 05:57:34 -1100 Subject: [PATCH 24/31] Start at 5000 --- src/cc/dapps/zmigrate.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/cc/dapps/zmigrate.c b/src/cc/dapps/zmigrate.c index 42e7d0fe5..31928c7d1 100644 --- a/src/cc/dapps/zmigrate.c +++ b/src/cc/dapps/zmigrate.c @@ -932,18 +932,16 @@ again: if ( (amount= find_sprout_amount(coinstr,zcaddr)) > txfee ) { // generate taddr, send max of 10000.0001 - static int64_t lastamount,lastamount2,lastamount3,lastamount4,refamount = 500 * SATOSHIDEN; - stdamount = 500 * SATOSHIDEN; + static int64_t lastamount,lastamount2,lastamount3,lastamount4,refamount = 5000 * SATOSHIDEN; + stdamount = refamount; if ( amount == lastamount && amount == lastamount2 ) { stdamount /= 10; if ( amount == lastamount3 && amount == lastamount4 ) - stdamount /= 5; + stdamount /= 10; } if ( stdamount < refamount ) refamount = stdamount; - else if ( refamount > stdamount ) - stdamount = refamount; lastamount4 = lastamount3; lastamount3 = lastamount2; lastamount2 = lastamount; From 7b30d56d3ddfc03eefe611fdd78e5c1e92d6d5db Mon Sep 17 00:00:00 2001 From: "Jonathan \"Duke\" Leto" Date: Sat, 15 Dec 2018 10:29:00 -0800 Subject: [PATCH 25/31] Add makefile and readme for CC dapps --- src/cc/dapps/Makefile | 11 +++++++++++ src/cc/dapps/README.md | 28 ++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 src/cc/dapps/Makefile create mode 100644 src/cc/dapps/README.md diff --git a/src/cc/dapps/Makefile b/src/cc/dapps/Makefile new file mode 100644 index 000000000..6e7874788 --- /dev/null +++ b/src/cc/dapps/Makefile @@ -0,0 +1,11 @@ +# just type make to compile all dapps +all: zmigrate oraclefeed + +zmigrate: + $(CC) zmigrate.c -o zmigrate -lm + +oraclefeed: + $(CC) oraclefeed.c -o oraclefeed -lm + +clean: + rm zmigrate oraclefeed diff --git a/src/cc/dapps/README.md b/src/cc/dapps/README.md new file mode 100644 index 000000000..0d8b2cac2 --- /dev/null +++ b/src/cc/dapps/README.md @@ -0,0 +1,28 @@ +# CryptoCondition dApps + +## Compiling + +To compile all dapps in this directory: + + make + +## zmigrate - Sprout to Sapling Migration dApp + +This tool converts Sprout zaddress funds into Sapling funds in a new Sapling address. + +### Usage + + ./zmigrate zsaplingaddr + +The above command may need to be run multiple times to complete the process. + +This CLI implementation will be called by GUI wallets, average users do not +need to worry about using this low-level tool. + +## oraclefeed - feed of price data using oracles + +### Usage + + ./oraclefeed $ACNAME $ORACLETXID $MYPUBKEY $FORMAT $BINDTXID [refcoin_cli] + +Supported formats are L and Ihh. Price data from CoinDesk API. From ba0c0794ebcdd7c7883a00f847c830b83ae7180e Mon Sep 17 00:00:00 2001 From: jl777 Date: Sat, 15 Dec 2018 07:43:08 -1100 Subject: [PATCH 26/31] Add three to migrate --- src/cc/dapps/zmigrate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cc/dapps/zmigrate.c b/src/cc/dapps/zmigrate.c index 31928c7d1..84cf4b057 100644 --- a/src/cc/dapps/zmigrate.c +++ b/src/cc/dapps/zmigrate.c @@ -946,8 +946,8 @@ again: lastamount3 = lastamount2; lastamount2 = lastamount; lastamount = amount; - if ( amount > stdamount+txfee ) - amount = stdamount + txfee; + if ( amount > stdamount+2*txfee ) + amount = stdamount + 2*txfee; if ( getnewaddress(coinaddr,coinstr,"") == 0 ) { z_sendmany(opidstr,coinstr,"",zcaddr,coinaddr,amount-txfee); From a528f1bd779f4ccdd64a3e4b28f60da76ce4a739 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 16 Dec 2018 15:52:32 +0800 Subject: [PATCH 27/31] Don't add z-tx to the mempool on block validation. Causes needless slowdowns and error messages. --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index a2314f644..3a8c4502e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4705,7 +4705,7 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C CValidationState state; CTransaction Tx; const CTransaction &tx = (CTransaction)block.vtx[i]; - if (tx.IsCoinBase() || ((i == (block.vtx.size() - 1)) && (ASSETCHAINS_STAKED && komodo_isPoS((CBlock *)&block) != 0))) + if (tx.IsCoinBase() || tx.vjoinsplit.size() != 0 || ((i == (block.vtx.size() - 1)) && (ASSETCHAINS_STAKED && komodo_isPoS((CBlock *)&block) != 0))) continue; Tx = tx; if ( myAddtomempool(Tx, &state) == false ) // happens with out of order tx in block on resync From f4b2975279fbfd8a4e30e349ebc38d9f4ac3bfa6 Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 16 Dec 2018 19:14:33 +0800 Subject: [PATCH 28/31] Updated change to mempool fix. Will skip all sapling and sprout txs at each stage. --- src/main.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 3a8c4502e..b0513f25f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4686,7 +4686,7 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C BOOST_FOREACH(const CTxMemPoolEntry& e, mempool.mapTx) { const CTransaction &tx = e.GetTx(); const uint256 &hash = tx.GetHash(); - if ( tx.vjoinsplit.size() == 0 ) { + if ( tx.vjoinsplit.empty() || tx.vShieldedSpend.empty()) { transactionsToRemove.push_back(tx); tmpmempool.addUnchecked(hash,e,true); } @@ -4705,7 +4705,7 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C CValidationState state; CTransaction Tx; const CTransaction &tx = (CTransaction)block.vtx[i]; - if (tx.IsCoinBase() || tx.vjoinsplit.size() != 0 || ((i == (block.vtx.size() - 1)) && (ASSETCHAINS_STAKED && komodo_isPoS((CBlock *)&block) != 0))) + if (tx.IsCoinBase() || !tx.vjoinsplit.empty() || !tx.vShieldedSpend.empty() || ((i == (block.vtx.size() - 1)) && (ASSETCHAINS_STAKED && komodo_isPoS((CBlock *)&block) != 0))) continue; Tx = tx; if ( myAddtomempool(Tx, &state) == false ) // happens with out of order tx in block on resync @@ -4773,9 +4773,7 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C { const CTransaction &tx = e.GetTx(); const uint256 &hash = tx.GetHash(); - if ( tx.vjoinsplit.size() == 0 ) { - mempool.addUnchecked(hash,e,true); - } + mempool.addUnchecked(hash,e,true); } //fprintf(stderr, "finished adding back. mempoolsize.%ld\n",mempool.size()); // empty the temp mempool for next time. From 94c37803df44d686bada6c66a8447f02948dc1ea Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 16 Dec 2018 21:06:17 +0800 Subject: [PATCH 29/31] Final fix for mempool --- src/cc/CCinclude.h | 6 +++--- src/main.cpp | 12 ++++++------ src/main.h | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/cc/CCinclude.h b/src/cc/CCinclude.h index 83c85e551..28091b957 100644 --- a/src/cc/CCinclude.h +++ b/src/cc/CCinclude.h @@ -24,7 +24,7 @@ so you can pay to a pubkey, or to its hash. or to a script's hash. the last is h all of the above are the standard bitcoin vout types and there should be plenty of materials about it Encrypted by a verified device what I did with the CC contracts is created a fourth type of vout, the CC vout. this is using the cryptoconditions standard and it is even a different signature mechanism. ed25519 instead of secp256k1. it is basically a big extension to the bitcoin script. There is a special opcode that is added that says it is a CC script. - + but it gets more interesting each CC script has an evalcode this is just an arbitrary number. but what it does is allows to create a self-contained universe of CC utxo that all have the same evalcode and that is how a faucet CC differentiates itself from a dice CC, the eval code is different @@ -73,7 +73,7 @@ struct CC_utxo // these are the parameters stored after Verus crypto-condition vouts. new versions may change // the format -struct CC_meta +struct CC_meta { std::vector version; uint8_t evalCode; @@ -110,7 +110,7 @@ int32_t komodo_nextheight(); static const uint256 zeroid; bool myGetTransaction(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock); int32_t is_hexstr(char *str,int32_t n); -bool myAddtomempool(CTransaction &tx, CValidationState *pstate = NULL); +bool myAddtomempool(CTransaction &tx, CValidationState *pstate = NULL, bool fSkipExpiry = false); //uint64_t myGettxout(uint256 hash,int32_t n); bool myIsutxo_spentinmempool(uint256 txid,int32_t vout); bool mytxid_inmempool(uint256 txid); diff --git a/src/main.cpp b/src/main.cpp index b0513f25f..d44207db9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1597,7 +1597,7 @@ CAmount GetMinRelayFee(const CTransaction& tx, unsigned int nBytes, bool fAllowF } -bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransaction &tx, bool fLimitFree,bool* pfMissingInputs, bool fRejectAbsurdFee, int dosLevel) +bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransaction &tx, bool fLimitFree,bool* pfMissingInputs, bool fRejectAbsurdFee, int dosLevel, bool fSkipExpiry) { AssertLockHeld(cs_main); if (pfMissingInputs) @@ -1634,7 +1634,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa } // DoS level set to 10 to be more forgiving. // Check transaction contextually against the set of consensus rules which apply in the next block to be mined. - if (!ContextualCheckTransaction(tx, state, nextBlockHeight, (dosLevel == -1) ? 10 : dosLevel)) + if (!fSkipExpiry && !ContextualCheckTransaction(tx, state, nextBlockHeight, (dosLevel == -1) ? 10 : dosLevel)) { return error("AcceptToMemoryPool: ContextualCheckTransaction failed"); } @@ -1973,14 +1973,14 @@ bool GetAddressUnspent(uint160 addressHash, int type, else return(coins.vout[n].nValue); }*/ -bool myAddtomempool(CTransaction &tx, CValidationState *pstate) +bool myAddtomempool(CTransaction &tx, CValidationState *pstate, bool fSkipExpiry) { CValidationState state; if (!pstate) pstate = &state; CTransaction Ltx; bool fMissingInputs,fOverrideFees = false; if ( mempool.lookup(tx.GetHash(),Ltx) == 0 ) - return(AcceptToMemoryPool(mempool, *pstate, tx, false, &fMissingInputs, !fOverrideFees)); + return(AcceptToMemoryPool(mempool, *pstate, tx, false, &fMissingInputs, !fOverrideFees, -1, fSkipExpiry)); else return(true); } @@ -4686,7 +4686,7 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C BOOST_FOREACH(const CTxMemPoolEntry& e, mempool.mapTx) { const CTransaction &tx = e.GetTx(); const uint256 &hash = tx.GetHash(); - if ( tx.vjoinsplit.empty() || tx.vShieldedSpend.empty()) { + if ( tx.vjoinsplit.empty() && tx.vShieldedSpend.empty()) { transactionsToRemove.push_back(tx); tmpmempool.addUnchecked(hash,e,true); } @@ -4708,7 +4708,7 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C if (tx.IsCoinBase() || !tx.vjoinsplit.empty() || !tx.vShieldedSpend.empty() || ((i == (block.vtx.size() - 1)) && (ASSETCHAINS_STAKED && komodo_isPoS((CBlock *)&block) != 0))) continue; Tx = tx; - if ( myAddtomempool(Tx, &state) == false ) // happens with out of order tx in block on resync + if ( myAddtomempool(Tx, &state, true) == false ) // happens with out of order tx in block on resync { //LogPrintf("Rejected by mempool, reason: .%s.\n", state.GetRejectReason().c_str()); // take advantage of other checks, but if we were only rejected because it is a valid staking diff --git a/src/main.h b/src/main.h index 00055b39c..fdd9fcae8 100644 --- a/src/main.h +++ b/src/main.h @@ -274,7 +274,7 @@ void PruneAndFlush(); /** (try to) add transaction to memory pool **/ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransaction &tx, bool fLimitFree, - bool* pfMissingInputs, bool fRejectAbsurdFee=false, int dosLevel=-1); + bool* pfMissingInputs, bool fRejectAbsurdFee=false, int dosLevel=-1, bool fSkipExpiry=false); struct CNodeStateStats { From cd42ca7d934b5d50f354f8004537f82aa3d9fa0f Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 16 Dec 2018 21:08:33 +0800 Subject: [PATCH 30/31] put mempool print back in now --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index d44207db9..ed150b3e6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1731,7 +1731,7 @@ bool AcceptToMemoryPool(CTxMemPool& pool, CValidationState &state, const CTransa if (pfMissingInputs) *pfMissingInputs = true; //fprintf(stderr,"missing inputs\n"); - //return state.DoS(0, error("AcceptToMemoryPool: tx inputs not found"),REJECT_INVALID, "bad-txns-inputs-missing"); + return state.DoS(0, error("AcceptToMemoryPool: tx inputs not found"),REJECT_INVALID, "bad-txns-inputs-missing"); return(false); } } From 7fe18c8196ae6c891d0eb59ebf0df1b92a3a1e1e Mon Sep 17 00:00:00 2001 From: blackjok3r Date: Sun, 16 Dec 2018 21:33:23 +0800 Subject: [PATCH 31/31] fix other test for ztx --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index ed150b3e6..182888a8b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4705,7 +4705,7 @@ bool CheckBlock(int32_t *futureblockp,int32_t height,CBlockIndex *pindex,const C CValidationState state; CTransaction Tx; const CTransaction &tx = (CTransaction)block.vtx[i]; - if (tx.IsCoinBase() || !tx.vjoinsplit.empty() || !tx.vShieldedSpend.empty() || ((i == (block.vtx.size() - 1)) && (ASSETCHAINS_STAKED && komodo_isPoS((CBlock *)&block) != 0))) + if (tx.IsCoinBase() || (!tx.vjoinsplit.empty() && !tx.vShieldedSpend.empty()) || ((i == (block.vtx.size() - 1)) && (ASSETCHAINS_STAKED && komodo_isPoS((CBlock *)&block) != 0))) continue; Tx = tx; if ( myAddtomempool(Tx, &state, true) == false ) // happens with out of order tx in block on resync