From 0a68a9a71c89c9d4c319859d170f2c820dc10ff6 Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 26 Nov 2018 22:05:31 -1100 Subject: [PATCH 1/4] Reenable -ac_sapling option --- 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 ec1e4e67e..0b6704752 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -1778,7 +1778,7 @@ void komodo_args(char *argv0) if ( (ASSETCHAINS_LWMAPOS = GetArg("-ac_veruspos",0)) != 0 ) ASSETCHAINS_LWMAPOS = 50; - /*ASSETCHAINS_SAPLING = GetArg("-ac_sapling", -1); + ASSETCHAINS_SAPLING = GetArg("-ac_sapling", -1); if (ASSETCHAINS_SAPLING == -1) { ASSETCHAINS_OVERWINTER = GetArg("-ac_overwinter", -1); @@ -1786,7 +1786,7 @@ void komodo_args(char *argv0) else { ASSETCHAINS_OVERWINTER = GetArg("-ac_overwinter", ASSETCHAINS_SAPLING); - }*/ + } if ( strlen(ASSETCHAINS_OVERRIDE_PUBKEY.c_str()) == 66 || ASSETCHAINS_SCRIPTPUB.size() > 1 ) { if ( strlen(ASSETCHAINS_OVERRIDE_PUBKEY.c_str()) == 66 ) From 3065bbdcc43e1d22b9a6abbcb9d693608632078c Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Nov 2018 05:01:27 -1100 Subject: [PATCH 2/4] Prevent timeout by non-owner --- src/cc/dice.cpp | 17 ++++++++++++++++- src/main.cpp | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index 244f26780..df6fa942b 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -1475,9 +1475,9 @@ std::string DiceBetFinish(uint8_t &funcid,uint256 &entropyused,int32_t &entropyv return(""); } fundingpk = DiceFundingPk(fundingPubKey); + scriptPubKey = CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG; if ( winlosetimeout != 0 ) // must be dealernode { - scriptPubKey = CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG; if ( scriptPubKey != fundingPubKey ) { //fprintf(stderr,"only dice fund creator can submit winner or loser\n"); @@ -1615,6 +1615,15 @@ std::string DiceBetFinish(uint8_t &funcid,uint256 &entropyused,int32_t &entropyv //fprintf(stderr,"make tx.%c\n",funcid); if ( funcid == 'L' || funcid == 'W' ) // dealernode only hentropy = DiceHashEntropy(entropy,mtx.vin[0].prevout.hash,mtx.vin[0].prevout.n,1); + else + { + if ( fundingpk != scriptPubKey && scriptPubKey != betTx.vout[2].scriptPubKey ) + { + CCerror = strprintf("can only finish your own bettxid\n"); + fprintf(stderr,"%s\n", CCerror.c_str() ); + return(""); + } + } *resultp = 1; //char str[65],str2[65]; //fprintf(stderr,"iswin.%d house entropy %s vs bettor %s\n",iswin,uint256_str(str,hentropyproof),uint256_str(str2,bettorentropy)); @@ -1710,6 +1719,12 @@ double DiceStatus(uint64_t txfee,char *planstr,uint256 fundingtxid,uint256 bettx GetCCaddress(cp,coinaddr,dicepk); if ( bettxid == zeroid ) // scan { + if ( fundingpk != scriptPubkey ) + { + CCerror = "Diceinit error in status, non-dealer must provide bettxid"; + fprintf(stderr,"%s\n", CCerror.c_str() ); + return(0.); + } std::vector > unspentOutputs; SetCCunspents(unspentOutputs,coinaddr); for (std::vector >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++) diff --git a/src/main.cpp b/src/main.cpp index a663296e7..edd1b6605 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3824,7 +3824,7 @@ int32_t komodo_activate_sapling(CBlockIndex *pindex) } height = pindex->GetHeight(); blocktime = (uint32_t)pindex->nTime; - fprintf(stderr,"komodo_activate_sapling.%d starting blocktime %u cmp.%d\n",height,blocktime,blocktime > KOMODO_SAPLING_ACTIVATION); + //fprintf(stderr,"komodo_activate_sapling.%d starting blocktime %u cmp.%d\n",height,blocktime,blocktime > KOMODO_SAPLING_ACTIVATION); // avoid trying unless we have at least 30 blocks if (height < 30) From 3be59de4ab102a9113d54aea2c6fd9c9eaa4b6ca Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Nov 2018 05:02:21 -1100 Subject: [PATCH 3/4] Add K --- src/cc/dice.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index df6fa942b..0cc646d79 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -1719,7 +1719,7 @@ double DiceStatus(uint64_t txfee,char *planstr,uint256 fundingtxid,uint256 bettx GetCCaddress(cp,coinaddr,dicepk); if ( bettxid == zeroid ) // scan { - if ( fundingpk != scriptPubkey ) + if ( fundingpk != scriptPubKey ) { CCerror = "Diceinit error in status, non-dealer must provide bettxid"; fprintf(stderr,"%s\n", CCerror.c_str() ); From 377e885bd43c436b5449c098699ad7464c4d1b1c Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 27 Nov 2018 05:04:14 -1100 Subject: [PATCH 4/4] Fixes --- src/cc/dice.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cc/dice.cpp b/src/cc/dice.cpp index 0cc646d79..a434a407a 100644 --- a/src/cc/dice.cpp +++ b/src/cc/dice.cpp @@ -1617,7 +1617,7 @@ std::string DiceBetFinish(uint8_t &funcid,uint256 &entropyused,int32_t &entropyv hentropy = DiceHashEntropy(entropy,mtx.vin[0].prevout.hash,mtx.vin[0].prevout.n,1); else { - if ( fundingpk != scriptPubKey && scriptPubKey != betTx.vout[2].scriptPubKey ) + if ( scriptPubKey != betTx.vout[2].scriptPubKey ) { CCerror = strprintf("can only finish your own bettxid\n"); fprintf(stderr,"%s\n", CCerror.c_str() ); @@ -1719,7 +1719,7 @@ double DiceStatus(uint64_t txfee,char *planstr,uint256 fundingtxid,uint256 bettx GetCCaddress(cp,coinaddr,dicepk); if ( bettxid == zeroid ) // scan { - if ( fundingpk != scriptPubKey ) + if ( fundingpk != mypk ) { CCerror = "Diceinit error in status, non-dealer must provide bettxid"; fprintf(stderr,"%s\n", CCerror.c_str() );