diff --git a/src/komodo_bitcoind.h b/src/komodo_bitcoind.h index 653bd1456..0793a5a7f 100644 --- a/src/komodo_bitcoind.h +++ b/src/komodo_bitcoind.h @@ -1832,11 +1832,19 @@ int32_t komodo_checkPOW(int32_t slowflag,CBlock *pblock,int32_t height) else return(0); } -int32_t komodo_acpublic() +int32_t komodo_acpublic(uint32_t tiptime) { - int32_t acpublic = ASSETCHAINS_PUBLIC; - if ( (ASSETCHAINS_SYMBOL[0] == 0 || strcmp(ASSETCHAINS_SYMBOL,"ZEX") == 0) && tiptime >= KOMODO_SAPLING_DEADLINE ) - acpublic = 1; + int32_t acpublic = ASSETCHAINS_PUBLIC; CBlockPtr *pindex; + if ( acpublic == 0 ) + { + if ( tiptime == 0 ) + { + if ( (pindex= chainActive.LastTip()) != 0 ) + tiptime = pindex->nTime; + } + if ( (ASSETCHAINS_SYMBOL[0] == 0 || strcmp(ASSETCHAINS_SYMBOL,"ZEX") == 0) && tiptime >= KOMODO_SAPLING_DEADLINE ) + acpublic = 1; + } return(acpublic); } diff --git a/src/main.cpp b/src/main.cpp index a8af7d484..edb8aa0fb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1259,12 +1259,12 @@ int32_t komodo_isnotaryvout(char *coinaddr) // from ac_private chains only return(0); } -int32_t komodo_acpublic(); +int32_t komodo_acpublic(uint32_t tiptime); bool CheckTransactionWithoutProofVerification(uint32_t tiptime,const CTransaction& tx, CValidationState &state) { // Basic checks that don't depend on any context - int32_t invalid_private_taddr=0,z_z=0,z_t=0,t_z=0,acpublic = komodo_acpublic(); + int32_t invalid_private_taddr=0,z_z=0,z_t=0,t_z=0,acpublic = komodo_acpublic(tiptime); /** * Previously: * 1. The consensus rule below was: diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 39a9b8518..f269e86f0 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -2342,7 +2342,7 @@ UniValue walletlock(const UniValue& params, bool fHelp) return NullUniValue; } -int32_t komodo_acpublic(); +int32_t komodo_acpublic(uint32_t tiptime); UniValue encryptwallet(const UniValue& params, bool fHelp) { @@ -2350,7 +2350,7 @@ UniValue encryptwallet(const UniValue& params, bool fHelp) return NullUniValue; string enableArg = "developerencryptwallet"; - flag = (komodo_acpublic() || ASSETCHAINS_SYMBOL[0] == 0); + flag = (komodo_acpublic(0) || ASSETCHAINS_SYMBOL[0] == 0); auto fEnableWalletEncryption = fExperimentalMode && GetBoolArg("-" + enableArg, flag); std::string strWalletEncryptionDisabledMsg = "";