diff --git a/src/cc/CCutils.cpp b/src/cc/CCutils.cpp index 145eef906..6a3e22ab1 100644 --- a/src/cc/CCutils.cpp +++ b/src/cc/CCutils.cpp @@ -664,6 +664,16 @@ uint256 BitcoinGetProofMerkleRoot(const std::vector &proofData, std::ve return merkleBlock.txn.ExtractMatches(txids); } +extern struct NSPV_inforesp NSPV_inforesult; +int32_t komodo_get_current_height() +{ + if ( KOMODO_NSPV_SUPERLITE ) + { + return (NSPV_inforesult.height); + } + else return chainActive.LastTip()->GetHeight(); +} + bool komodo_txnotarizedconfirmed(uint256 txid) { char str[65]; diff --git a/src/cc/oracles.cpp b/src/cc/oracles.cpp index a5a3b0f14..f5c90aee6 100644 --- a/src/cc/oracles.cpp +++ b/src/cc/oracles.cpp @@ -92,7 +92,7 @@ vout.n-1: opreturn with oracletxid, prevbatontxid and data in proper format */ -extern int32_t komodo_currentheight(); +extern int32_t komodo_get_current_height(); #define PUBKEY_SPOOFING_FIX_ACTIVATION 1563148800 #define CC_MARKER_VALUE 10000 @@ -896,7 +896,7 @@ std::string OracleFund(int64_t txfee,uint256 oracletxid) CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight()); CPubKey mypk,oraclespk; struct CCcontract_info *cp,C; - if (GetLatestTimestamp(komodo_currentheight())PUBKEY_SPOOFING_FIX_ACTIVATION && AddMyOraclesFunds(cp,mtx,mypk,oracletxid)!=CC_MARKER_VALUE) + if (GetLatestTimestamp(komodo_get_current_height())>PUBKEY_SPOOFING_FIX_ACTIVATION && AddMyOraclesFunds(cp,mtx,mypk,oracletxid)!=CC_MARKER_VALUE) { CCerror = strprintf("error adding inputs from your Oracles CC address, please fund it first with oraclesfund rpc!"); fprintf(stderr,"%s\n", CCerror.c_str() ); @@ -944,7 +944,7 @@ std::string OracleRegister(int64_t txfee,uint256 oracletxid,int64_t datafee) } mtx.vout.push_back(CTxOut(txfee,CScript() << ParseHex(HexStr(markerpubkey)) << OP_CHECKSIG)); mtx.vout.push_back(MakeCC1vout(cp->evalcode,txfee,batonpk)); - if (GetLatestTimestamp(komodo_currentheight())>PUBKEY_SPOOFING_FIX_ACTIVATION) mtx.vout.push_back(CTxOut(txfee,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG)); + if (GetLatestTimestamp(komodo_get_current_height())>PUBKEY_SPOOFING_FIX_ACTIVATION) mtx.vout.push_back(CTxOut(txfee,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG)); return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeOraclesOpRet('R',oracletxid,mypk,datafee))); } CCerror = strprintf("error adding normal inputs");