diff --git a/src/komodo-tx.cpp b/src/komodo-tx.cpp index 084d99c8049..f2d0d1ac542 100644 --- a/src/komodo-tx.cpp +++ b/src/komodo-tx.cpp @@ -200,6 +200,12 @@ int32_t komodo_nextheight() return(100000000); } +// function stub to allow build komodo-tx +bool komodo_is_vSolutionsFixActive() +{ + return true; +} + // Set default values of new CMutableTransaction based on consensus rules at given height. CMutableTransaction CreateNewContextualCMutableTransaction(const Consensus::Params& consensusParams, int nHeight) diff --git a/src/komodo_utils.h b/src/komodo_utils.h index 9f2ec53fce7..f21241cccc2 100644 --- a/src/komodo_utils.h +++ b/src/komodo_utils.h @@ -2497,3 +2497,10 @@ void komodo_prefetch(FILE *fp) } fseek(fp,fpos,SEEK_SET); } + +// check if block timestamp is more than S5 activation time +// this function is to activate the ExtractDestination fix +bool komodo_is_vSolutionsFixActive() +{ + return GetLatestTimestamp(komodo_currentheight()) > nS5Timestamp; +} diff --git a/src/script/standard.cpp b/src/script/standard.cpp index ee681642c6a..4c57388adc9 100644 --- a/src/script/standard.cpp +++ b/src/script/standard.cpp @@ -34,6 +34,8 @@ typedef vector valtype; unsigned nMaxDatacarrierBytes = MAX_OP_RETURN_RELAY; +bool komodo_is_vSolutionsFixActive(); // didn't want to bring komodo headers here, it's a special case to bypass bad code in Solver() and ExtractDestination() + COptCCParams::COptCCParams(std::vector &vch) { CScript inScr = CScript(vch.begin(), vch.end()); @@ -244,14 +246,19 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, std::vector(k.begin(), k.end())); + for (auto k : cp.vKeys) + { + vSolutionsRet.push_back(std::vector(k.begin(), k.end())); // we do not need opdrop pubkeys in vSolution as it breaks indexes + } } } } @@ -385,7 +392,7 @@ bool ExtractDestination(const CScript& _scriptPubKey, CTxDestination& addressRet else if (IsCryptoConditionsEnabled() != 0 && whichType == TX_CRYPTOCONDITION) { - if (vSolutions.size() > 1) + if (vSolutions.size() > 1 && !komodo_is_vSolutionsFixActive()) // allow this temporarily before the HF; actually this is incorrect to use opdrop's pubkey as the address { CPubKey pk = CPubKey((vSolutions[1])); addressRet = pk; diff --git a/src/wallet-utility.cpp b/src/wallet-utility.cpp index 0b664ecb35a..f7717affa9c 100644 --- a/src/wallet-utility.cpp +++ b/src/wallet-utility.cpp @@ -356,3 +356,9 @@ int main(int argc, char* argv[]) else return -1; } + +// function stub to allow build wallet-utility +bool komodo_is_vSolutionsFixActive() +{ + return true; +} \ No newline at end of file