Fix oracles pubkey spoofing
This commit is contained in:
@@ -664,6 +664,16 @@ uint256 BitcoinGetProofMerkleRoot(const std::vector<uint8_t> &proofData, std::ve
|
|||||||
return merkleBlock.txn.ExtractMatches(txids);
|
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)
|
bool komodo_txnotarizedconfirmed(uint256 txid)
|
||||||
{
|
{
|
||||||
char str[65];
|
char str[65];
|
||||||
|
|||||||
@@ -92,7 +92,7 @@
|
|||||||
vout.n-1: opreturn with oracletxid, prevbatontxid and data in proper format
|
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 PUBKEY_SPOOFING_FIX_ACTIVATION 1563148800
|
||||||
#define CC_MARKER_VALUE 10000
|
#define CC_MARKER_VALUE 10000
|
||||||
|
|
||||||
@@ -896,7 +896,7 @@ std::string OracleFund(int64_t txfee,uint256 oracletxid)
|
|||||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), komodo_nextheight());
|
||||||
CPubKey mypk,oraclespk; struct CCcontract_info *cp,C;
|
CPubKey mypk,oraclespk; struct CCcontract_info *cp,C;
|
||||||
|
|
||||||
if (GetLatestTimestamp(komodo_currentheight())<PUBKEY_SPOOFING_FIX_ACTIVATION)
|
if (GetLatestTimestamp(komodo_get_current_height())<PUBKEY_SPOOFING_FIX_ACTIVATION)
|
||||||
{
|
{
|
||||||
CCerror = strprintf("oraclesfund not active yet, activation scheduled for July 15th");
|
CCerror = strprintf("oraclesfund not active yet, activation scheduled for July 15th");
|
||||||
fprintf(stderr,"%s\n", CCerror.c_str() );
|
fprintf(stderr,"%s\n", CCerror.c_str() );
|
||||||
@@ -936,7 +936,7 @@ std::string OracleRegister(int64_t txfee,uint256 oracletxid,int64_t datafee)
|
|||||||
markerpubkey = CCtxidaddr(markeraddr,oracletxid);
|
markerpubkey = CCtxidaddr(markeraddr,oracletxid);
|
||||||
if (AddNormalinputs(mtx,mypk,3*txfee,4))
|
if (AddNormalinputs(mtx,mypk,3*txfee,4))
|
||||||
{
|
{
|
||||||
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!");
|
CCerror = strprintf("error adding inputs from your Oracles CC address, please fund it first with oraclesfund rpc!");
|
||||||
fprintf(stderr,"%s\n", CCerror.c_str() );
|
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(CTxOut(txfee,CScript() << ParseHex(HexStr(markerpubkey)) << OP_CHECKSIG));
|
||||||
mtx.vout.push_back(MakeCC1vout(cp->evalcode,txfee,batonpk));
|
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)));
|
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeOraclesOpRet('R',oracletxid,mypk,datafee)));
|
||||||
}
|
}
|
||||||
CCerror = strprintf("error adding normal inputs");
|
CCerror = strprintf("error adding normal inputs");
|
||||||
|
|||||||
Reference in New Issue
Block a user