More error checking in oracle and gateway RPCs

This commit is contained in:
Jonathan "Duke" Leto
2018-11-20 15:53:29 -08:00
parent 8c66ce0a7f
commit 87f557bd32
3 changed files with 23 additions and 7 deletions

View File

@@ -794,13 +794,13 @@ std::string OracleData(int64_t txfee,uint256 oracletxid,std::vector <uint8_t> da
mypk = pubkey2pk(Mypubkey());
if ( data.size() > 8192 )
{
CCerror = strprintf("datasize %d is too big\n",(int32_t)data.size());
CCerror = strprintf("datasize %d is too big",(int32_t)data.size());
fprintf(stderr,"%s\n", CCerror.c_str() );
return("");
}
if ( (datafee= OracleDatafee(pubKey,oracletxid,mypk)) <= 0 )
{
CCerror = strprintf("datafee %.8f is illegal\n",(double)datafee/COIN);
CCerror = strprintf("datafee %.8f is illegal",(double)datafee/COIN);
fprintf(stderr,"%s\n", CCerror.c_str() );
return("");
}
@@ -822,8 +822,14 @@ std::string OracleData(int64_t txfee,uint256 oracletxid,std::vector <uint8_t> da
mtx.vout.push_back(MakeCC1vout(cp->evalcode,txfee,batonpk));
mtx.vout.push_back(CTxOut(datafee,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG));
return(FinalizeCCTx(0,cp,mtx,mypk,txfee,EncodeOraclesData('D',oracletxid,batontxid,mypk,data)));
} else fprintf(stderr,"couldnt find enough oracle inputs %s, limit 1 per utxo\n",coinaddr);
} else fprintf(stderr,"couldnt add normal inputs\n");
} else {
CCerror = strprintf("couldnt find enough oracle inputs %s, limit 1 per utxo\n",coinaddr);
fprintf(stderr,"%s\n", CCerror.c_str() );
}
} else {
CCerror = strprintf("couldnt add normal inputs\n");
fprintf(stderr,"%s\n", CCerror.c_str() );
}
return("");
}