Prints
This commit is contained in:
@@ -26,6 +26,7 @@
|
||||
#include <exception>
|
||||
|
||||
extern uint8_t NOTARY_PUBKEY33[33];
|
||||
uint256 Parseuint256(char *hexstr);
|
||||
|
||||
// code rpc
|
||||
|
||||
@@ -465,7 +466,7 @@ bool SignTx(CMutableTransaction &mtx,int32_t vini,uint64_t utxovalue,const CScri
|
||||
{
|
||||
UpdateTransaction(mtx,vini,sigdata);
|
||||
return(true);
|
||||
} else fprintf(stderr,"signing error for CreateAsset\n");
|
||||
} else fprintf(stderr,"signing error for CreateAsset vini.%d %.8f\n",vini,(double)utxovalue/COIN);
|
||||
#else
|
||||
return(false);
|
||||
#endif
|
||||
@@ -501,11 +502,13 @@ std::string FinalizeCCTx(uint8_t evalcode,CMutableTransaction &mtx,CPubKey mypk,
|
||||
totalinputs += utxovalues[i];
|
||||
if ( IsCCInput(mtx.vin[i].scriptSig) == 0 )
|
||||
{
|
||||
fprintf(stderr,"vin.%d is normal %.8f\n",i,(double)utxovalues[i]/COIN);
|
||||
vinimask |= (1LL << i);
|
||||
}
|
||||
else
|
||||
{
|
||||
Getscriptaddress(destaddr,vintx.vout[mtx.vin[i].prevout.n].scriptPubKey);
|
||||
fprintf(stderr,"vin.%d is CC %.8f -> (%s)\n",i,(double)utxovalues[i]/COIN,destaddr);
|
||||
if ( strcmp(destaddr,myaddr) == 0 )
|
||||
{
|
||||
privkey = myprivkey;
|
||||
@@ -618,11 +621,8 @@ bool SetFillamounts(uint64_t &paid,uint64_t &remaining_price,uint64_t orig_nValu
|
||||
uint64_t AddCCinputs(CMutableTransaction &mtx,CPubKey mypk,uint256 assetid,uint64_t total)
|
||||
{
|
||||
uint64_t totalinputs = 0;
|
||||
std::string assetidstr = "01eecd0fcaa2b0a9980c649e04a158135ebec2cbd1a3711089b90e196d5cab3e";
|
||||
std::vector<unsigned char> txData(ParseHex(assetidstr));
|
||||
uint256 txid;
|
||||
memcpy(&txid,txData.data(),sizeof(txid));
|
||||
mtx.vin.push_back(CTxIn(txid,0,CScript()));
|
||||
mtx.vin.push_back(CTxIn(Parseuint256("01eecd0fcaa2b0a9980c649e04a158135ebec2cbd1a3711089b90e196d5cab3e"),0,CScript()));
|
||||
totalinputs = COIN;
|
||||
return(totalinputs);
|
||||
}
|
||||
|
||||
@@ -727,10 +727,6 @@ std::string CancelBuyOffer(uint64_t txfee,uint256 bidtxid)
|
||||
mtx.vout.push_back(CTxOut(bidamount,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG));
|
||||
return(FinalizeCCTx(EVAL_ASSETS,mtx,mypk,txfee,EncodeOpRet('o',zeroid,zeroid,0,Mypubkey())));
|
||||
}
|
||||
int i;
|
||||
for (i=31; i>=0; i--)
|
||||
fprintf(stderr,"%02x",((uint8_t *)&bidtxid)[i]);
|
||||
fprintf(stderr,"couldnt find bidtxid\n");
|
||||
}
|
||||
fprintf(stderr,"no normal inputs\n");
|
||||
return(0);
|
||||
|
||||
@@ -4836,6 +4836,14 @@ std::string CreateBuyOffer(uint64_t txfee,uint64_t bidamount,uint256 assetid,uin
|
||||
std::string CancelBuyOffer(uint64_t txfee,uint256 bidtxid);
|
||||
std::string FillBuyOffer(uint64_t txfee,uint256 assetid,uint256 bidtxid,uint256 filltxid,int32_t fillvout);
|
||||
|
||||
uint256 Parseuint256(char *hexstr)
|
||||
{
|
||||
uint256 txid; std::vector<unsigned char> txidbytes(ParseHex(hexstr));
|
||||
for (i=31; i>=0; i--)
|
||||
((uint8_t *)&txid)[31-i] = ((uint8_t *)txidbytes.data())[i];
|
||||
return(txid);
|
||||
}
|
||||
|
||||
UniValue tokencreate(const UniValue& params, bool fHelp)
|
||||
{
|
||||
UniValue result(UniValue::VOBJ); std::string name,description,hex; uint64_t supply;
|
||||
@@ -4866,10 +4874,9 @@ UniValue tokenbid(const UniValue& params, bool fHelp)
|
||||
if ( fHelp || params.size() != 3 )
|
||||
throw runtime_error("tokenbid numtokens tokenid price\n");
|
||||
numtokens = atoi(params[0].get_str().c_str());
|
||||
std::vector<unsigned char> tokid(ParseHex(params[1].get_str()));
|
||||
memcpy(&tokenid,tokid.data(),sizeof(tokenid));
|
||||
tokenid = Parseuint256(params[1].get_str().c_str());
|
||||
price = atof(params[2].get_str().c_str());
|
||||
bidamount = (price * numtokens) * COIN;
|
||||
bidamount = (price * numtokens) * COIN + 0.0000000049999;
|
||||
hex = CreateBuyOffer(0,bidamount,tokenid,numtokens);
|
||||
if ( hex.size() > 0 )
|
||||
{
|
||||
@@ -4881,13 +4888,10 @@ UniValue tokenbid(const UniValue& params, bool fHelp)
|
||||
|
||||
UniValue tokencancelbid(const UniValue& params, bool fHelp)
|
||||
{
|
||||
UniValue result(UniValue::VOBJ); std::string hex; uint256 bidtxid; int32_t i;
|
||||
UniValue result(UniValue::VOBJ); std::string hex; int32_t i;
|
||||
if ( fHelp || params.size() != 1 )
|
||||
throw runtime_error("tokencancelbid bidtxid\n");
|
||||
std::vector<unsigned char> bidid(ParseHex(params[0].get_str()));
|
||||
for (i=31; i>=0; i--)
|
||||
((uint8_t *)&bidtxid)[31-i] = ((uint8_t *)bidid.data())[i];
|
||||
hex = CancelBuyOffer(0,bidtxid);
|
||||
hex = CancelBuyOffer(0,Parseuint256(params[0].get_str().c_str());
|
||||
if ( hex.size() > 0 )
|
||||
{
|
||||
result.push_back(Pair("result", "success"));
|
||||
|
||||
Reference in New Issue
Block a user