Oracles pubkey spoofing in register tx fix

- Fix activation on July 15th 2019 00:00
- Added oraclesfund tx to fund Oracles CC address of pubkey that will register, and spend it in register tx
- oraclessamples gets baton address as input instead of txid to show all data from publisher
This commit is contained in:
Mihailo Milenkovic
2019-05-28 15:40:43 +02:00
committed by GitHub
parent 034746aa82
commit 01f597a2c8
5 changed files with 233 additions and 47 deletions

View File

@@ -6760,6 +6760,26 @@ UniValue oraclesinfo(const UniValue& params, bool fHelp)
return(OracleInfo(txid));
}
UniValue oraclesfund(const UniValue& params, bool fHelp)
{
UniValue result(UniValue::VOBJ); uint256 txid; std::string hex;
if ( fHelp || params.size() != 1 )
throw runtime_error("oraclesfund oracletxid\n");
if ( ensure_CCrequirements(EVAL_ORACLES) < 0 )
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
const CKeyStore& keystore = *pwalletMain;
LOCK2(cs_main, pwalletMain->cs_wallet);
txid = Parseuint256((char *)params[0].get_str().c_str());
hex = OracleFund(0,txid);
RETURN_IF_ERROR(CCerror);
if ( hex.size() > 0 )
{
result.push_back(Pair("result", "success"));
result.push_back(Pair("hex", hex));
} else ERR_RESULT("couldnt fund with oracle txid");
return(result);
}
UniValue oraclesregister(const UniValue& params, bool fHelp)
{
UniValue result(UniValue::VOBJ); uint256 txid; int64_t datafee; std::string hex;
@@ -6806,17 +6826,17 @@ UniValue oraclessubscribe(const UniValue& params, bool fHelp)
UniValue oraclessamples(const UniValue& params, bool fHelp)
{
UniValue result(UniValue::VOBJ); uint256 txid,batontxid; int32_t num;
UniValue result(UniValue::VOBJ); uint256 txid; int32_t num; char *batonaddr;
if ( fHelp || params.size() != 3 )
throw runtime_error("oraclessamples oracletxid batonutxo num\n");
throw runtime_error("oraclessamples oracletxid batonaddress num\n");
if ( ensure_CCrequirements(EVAL_ORACLES) < 0 )
throw runtime_error("to use CC contracts, you need to launch daemon with valid -pubkey= for an address in your wallet\n");
const CKeyStore& keystore = *pwalletMain;
LOCK2(cs_main, pwalletMain->cs_wallet);
txid = Parseuint256((char *)params[0].get_str().c_str());
batontxid = Parseuint256((char *)params[1].get_str().c_str());
batonaddr = (char *)params[1].get_str().c_str();
num = atoi((char *)params[2].get_str().c_str());
return(OracleDataSamples(txid,batontxid,num));
return(OracleDataSamples(txid,batonaddr,num));
}
UniValue oraclesdata(const UniValue& params, bool fHelp)