corr batontxid change
This commit is contained in:
@@ -472,9 +472,9 @@ int64_t prices_batontxid(uint256 &batontxid, CTransaction bettx, uint256 bettxid
|
|||||||
int32_t retcode;
|
int32_t retcode;
|
||||||
|
|
||||||
batontxid = bettxid; // initially set to the source bet tx
|
batontxid = bettxid; // initially set to the source bet tx
|
||||||
|
uint256 sourcetxid = bettxid;
|
||||||
// iterate through batons, adding up vout1 -> addedbets
|
// iterate through batons, adding up vout1 -> addedbets
|
||||||
while ((retcode = CCgetspenttxid(batontxid, vini, height, bettxid, 1)) == 0) {
|
while ((retcode = CCgetspenttxid(batontxid, vini, height, sourcetxid, 1)) == 0) {
|
||||||
|
|
||||||
CTransaction txBaton;
|
CTransaction txBaton;
|
||||||
uint256 hashBlock;
|
uint256 hashBlock;
|
||||||
@@ -492,7 +492,9 @@ int64_t prices_batontxid(uint256 &batontxid, CTransaction bettx, uint256 bettxid
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
std::cerr << "prices_batontxid() cannot load or decode add bet tx, isLoaded=" << isLoaded << " funcId=" << (int)funcId << std::endl;
|
std::cerr << "prices_batontxid() cannot load or decode add bet tx, isLoaded=" << isLoaded << " funcId=" << (int)funcId << std::endl;
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
sourcetxid = batontxid;
|
||||||
}
|
}
|
||||||
|
|
||||||
return(addedbets);
|
return(addedbets);
|
||||||
@@ -502,7 +504,11 @@ UniValue PricesBet(int64_t txfee,int64_t amount,int16_t leverage,std::vector<std
|
|||||||
{
|
{
|
||||||
int32_t nextheight = komodo_nextheight();
|
int32_t nextheight = komodo_nextheight();
|
||||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), nextheight); UniValue result(UniValue::VOBJ);
|
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), nextheight); UniValue result(UniValue::VOBJ);
|
||||||
struct CCcontract_info *cp,C; CPubKey pricespk,mypk; int64_t betamount,firstprice; std::vector<uint16_t> vec; char myaddr[64]; std::string rawtx;
|
struct CCcontract_info *cp, C; CPubKey pricespk, mypk; int64_t betamount, firstprice;
|
||||||
|
std::vector<uint16_t> vec;
|
||||||
|
char myaddr[64];
|
||||||
|
std::string rawtx;
|
||||||
|
|
||||||
if (leverage > PRICES_MAXLEVERAGE || leverage < -PRICES_MAXLEVERAGE)
|
if (leverage > PRICES_MAXLEVERAGE || leverage < -PRICES_MAXLEVERAGE)
|
||||||
{
|
{
|
||||||
result.push_back(Pair("result", "error"));
|
result.push_back(Pair("result", "error"));
|
||||||
@@ -540,13 +546,20 @@ UniValue PricesAddFunding(int64_t txfee, uint256 bettxid, int64_t amount)
|
|||||||
{
|
{
|
||||||
int32_t nextheight = komodo_nextheight();
|
int32_t nextheight = komodo_nextheight();
|
||||||
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), nextheight); UniValue result(UniValue::VOBJ);
|
CMutableTransaction mtx = CreateNewContextualCMutableTransaction(Params().GetConsensus(), nextheight); UniValue result(UniValue::VOBJ);
|
||||||
struct CCcontract_info *cp, C; CTransaction bettx; CPubKey pricespk, mypk; int64_t addedbets = 0, betamount, firstprice; std::vector<uint16_t> vec; uint256 batontxid; std::string rawtx; char myaddr[64];
|
struct CCcontract_info *cp, C; CTransaction bettx;
|
||||||
|
CPubKey pricespk, mypk;
|
||||||
|
//int64_t addedbets = 0, betamount, firstprice;
|
||||||
|
std::vector<uint16_t> vec;
|
||||||
|
uint256 batontxid;
|
||||||
|
std::string rawtx;
|
||||||
|
//char myaddr[64];
|
||||||
|
|
||||||
cp = CCinit(&C, EVAL_PRICES);
|
cp = CCinit(&C, EVAL_PRICES);
|
||||||
if (txfee == 0)
|
if (txfee == 0)
|
||||||
txfee = PRICES_TXFEE;
|
txfee = PRICES_TXFEE;
|
||||||
mypk = pubkey2pk(Mypubkey());
|
mypk = pubkey2pk(Mypubkey());
|
||||||
pricespk = GetUnspendable(cp, 0);
|
pricespk = GetUnspendable(cp, 0);
|
||||||
GetCCaddress(cp, myaddr, mypk);
|
//GetCCaddress(cp, myaddr, mypk);
|
||||||
if (AddNormalinputs(mtx, mypk, amount + 2*txfee, 64) >= amount + 2*txfee)
|
if (AddNormalinputs(mtx, mypk, amount + 2*txfee, 64) >= amount + 2*txfee)
|
||||||
{
|
{
|
||||||
if (prices_batontxid(batontxid, bettx, bettxid) >= 0)
|
if (prices_batontxid(batontxid, bettx, bettxid) >= 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user