@@ -296,13 +296,13 @@ CTxDestination CBitcoinAddress::Get() const
|
|||||||
return CNoDestination();
|
return CNoDestination();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CBitcoinAddress::GetIndexKey(uint160& hashBytes, int& type) const
|
bool CBitcoinAddress::GetIndexKey(uint160& hashBytes, int& type, bool ccflag) const
|
||||||
{
|
{
|
||||||
if (!IsValid()) {
|
if (!IsValid()) {
|
||||||
return false;
|
return false;
|
||||||
} else if (vchVersion == Params().Base58Prefix(CChainParams::PUBKEY_ADDRESS)) {
|
} else if (vchVersion == Params().Base58Prefix(CChainParams::PUBKEY_ADDRESS)) {
|
||||||
memcpy(&hashBytes, &vchData[0], 20);
|
memcpy(&hashBytes, &vchData[0], 20);
|
||||||
type = 1;
|
ccflag ? type = 3 : type = 1;
|
||||||
return true;
|
return true;
|
||||||
} else if (vchVersion == Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS)) {
|
} else if (vchVersion == Params().Base58Prefix(CChainParams::SCRIPT_ADDRESS)) {
|
||||||
memcpy(&hashBytes, &vchData[0], 20);
|
memcpy(&hashBytes, &vchData[0], 20);
|
||||||
@@ -392,13 +392,13 @@ CTxDestination CCustomBitcoinAddress::Get() const
|
|||||||
return CNoDestination();
|
return CNoDestination();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CCustomBitcoinAddress::GetIndexKey(uint160& hashBytes, int& type) const
|
bool CCustomBitcoinAddress::GetIndexKey(uint160& hashBytes, int& type, bool ccflag) const
|
||||||
{
|
{
|
||||||
if (!IsValid()) {
|
if (!IsValid()) {
|
||||||
return false;
|
return false;
|
||||||
} else if (vchVersion == base58Prefixes[0]) {
|
} else if (vchVersion == base58Prefixes[0]) {
|
||||||
memcpy(&hashBytes, &vchData[0], 20);
|
memcpy(&hashBytes, &vchData[0], 20);
|
||||||
type = 1;
|
ccflag ? type = 3 : type = 1;
|
||||||
return true;
|
return true;
|
||||||
} else if (vchVersion == base58Prefixes[1]) {
|
} else if (vchVersion == base58Prefixes[1]) {
|
||||||
memcpy(&hashBytes, &vchData[0], 20);
|
memcpy(&hashBytes, &vchData[0], 20);
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ public:
|
|||||||
CTxDestination Get() const;
|
CTxDestination Get() const;
|
||||||
bool GetKeyID(CKeyID &keyID) const;
|
bool GetKeyID(CKeyID &keyID) const;
|
||||||
bool GetKeyID_NoCheck(CKeyID& keyID) const;
|
bool GetKeyID_NoCheck(CKeyID& keyID) const;
|
||||||
bool GetIndexKey(uint160& hashBytes, int& type) const;
|
bool GetIndexKey(uint160& hashBytes, int& type, bool ccflag) const;
|
||||||
bool IsScript() const;
|
bool IsScript() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -172,7 +172,7 @@ public:
|
|||||||
CTxDestination Get() const;
|
CTxDestination Get() const;
|
||||||
bool GetKeyID(CKeyID &keyID) const;
|
bool GetKeyID(CKeyID &keyID) const;
|
||||||
bool GetKeyID_NoCheck(CKeyID& keyID) const;
|
bool GetKeyID_NoCheck(CKeyID& keyID) const;
|
||||||
bool GetIndexKey(uint160& hashBytes, int& type) const;
|
bool GetIndexKey(uint160& hashBytes, int& type, bool ccflag) const;
|
||||||
bool IsScript() const;
|
bool IsScript() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -16,55 +16,6 @@
|
|||||||
#include "CCassets.h"
|
#include "CCassets.h"
|
||||||
#include "CCtokens.h"
|
#include "CCtokens.h"
|
||||||
|
|
||||||
/* use AddTokenCCInputs instead
|
|
||||||
int64_t AddAssetInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKey pk,uint256 assetid,int64_t total,int32_t maxinputs)
|
|
||||||
{
|
|
||||||
char coinaddr[64],destaddr[64]; int64_t threshold,nValue,price,totalinputs = 0; uint256 txid,hashBlock; std::vector<uint8_t> origpubkey; CTransaction vintx; int32_t j,vout,n = 0;
|
|
||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
|
||||||
GetCCaddress(cp,coinaddr,pk);
|
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
|
||||||
|
|
||||||
threshold = total/(maxinputs!=0?maxinputs:64); // TODO: is maxinputs really not over 64, what if i want to calc total balance?
|
|
||||||
|
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
|
||||||
{
|
|
||||||
txid = it->first.txhash;
|
|
||||||
vout = (int32_t)it->first.index;
|
|
||||||
|
|
||||||
if (it->second.satoshis < threshold)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
for (j=0; j<mtx.vin.size(); j++)
|
|
||||||
if (txid == mtx.vin[j].prevout.hash && vout == mtx.vin[j].prevout.n)
|
|
||||||
break;
|
|
||||||
|
|
||||||
if( j != mtx.vin.size() )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if( GetTransaction(txid,vintx,hashBlock,false) != 0 )
|
|
||||||
{
|
|
||||||
Getscriptaddress(destaddr,vintx.vout[vout].scriptPubKey);
|
|
||||||
if( strcmp(destaddr,coinaddr) != 0 && strcmp(destaddr,cp->unspendableCCaddr) != 0 && strcmp(destaddr,cp->unspendableaddr2) != 0 )
|
|
||||||
continue;
|
|
||||||
fprintf(stderr,"AddAssetInputs() check destaddress=%s vout amount=%.8f\n",destaddr,(double)vintx.vout[vout].nValue/COIN);
|
|
||||||
if( (nValue = IsAssetvout(cp, price, origpubkey, vintx, vout, assetid)) > 0 && myIsutxo_spentinmempool(ignoretxid,ignorevin,txid,vout) == 0 )
|
|
||||||
{
|
|
||||||
if ( total != 0 && maxinputs != 0 )
|
|
||||||
mtx.vin.push_back(CTxIn(txid,vout,CScript()));
|
|
||||||
nValue = it->second.satoshis;
|
|
||||||
totalinputs += nValue;
|
|
||||||
//std::cerr << "AddAssetInputs() adding input nValue=" << nValue << std::endl;
|
|
||||||
n++;
|
|
||||||
if ( (total > 0 && totalinputs >= total) || (maxinputs > 0 && n >= maxinputs) )
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//std::cerr << "AddAssetInputs() found totalinputs=" << totalinputs << std::endl;
|
|
||||||
return(totalinputs);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
UniValue AssetOrders(uint256 refassetid, CPubKey pk, uint8_t additionalEvalCode)
|
UniValue AssetOrders(uint256 refassetid, CPubKey pk, uint8_t additionalEvalCode)
|
||||||
{
|
{
|
||||||
@@ -165,7 +116,7 @@ UniValue AssetOrders(uint256 refassetid, CPubKey pk, uint8_t additionalEvalCode)
|
|||||||
|
|
||||||
char assetsUnspendableAddr[64];
|
char assetsUnspendableAddr[64];
|
||||||
GetCCaddress(cpAssets, assetsUnspendableAddr, GetUnspendable(cpAssets, NULL));
|
GetCCaddress(cpAssets, assetsUnspendableAddr, GetUnspendable(cpAssets, NULL));
|
||||||
SetCCunspents(unspentOutputsCoins, assetsUnspendableAddr);
|
SetCCunspents(unspentOutputsCoins, assetsUnspendableAddr,true);
|
||||||
|
|
||||||
char assetsTokensUnspendableAddr[64];
|
char assetsTokensUnspendableAddr[64];
|
||||||
std::vector<uint8_t> vopretNonfungible;
|
std::vector<uint8_t> vopretNonfungible;
|
||||||
@@ -175,7 +126,7 @@ UniValue AssetOrders(uint256 refassetid, CPubKey pk, uint8_t additionalEvalCode)
|
|||||||
cpAssets->additionalTokensEvalcode2 = vopretNonfungible.begin()[0];
|
cpAssets->additionalTokensEvalcode2 = vopretNonfungible.begin()[0];
|
||||||
}
|
}
|
||||||
GetTokensCCaddress(cpAssets, assetsTokensUnspendableAddr, GetUnspendable(cpAssets, NULL));
|
GetTokensCCaddress(cpAssets, assetsTokensUnspendableAddr, GetUnspendable(cpAssets, NULL));
|
||||||
SetCCunspents(unspentOutputsTokens, assetsTokensUnspendableAddr);
|
SetCCunspents(unspentOutputsTokens, assetsTokensUnspendableAddr,true);
|
||||||
|
|
||||||
// tokenbids:
|
// tokenbids:
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator itCoins = unspentOutputsCoins.begin();
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator itCoins = unspentOutputsCoins.begin();
|
||||||
@@ -195,7 +146,7 @@ UniValue AssetOrders(uint256 refassetid, CPubKey pk, uint8_t additionalEvalCode)
|
|||||||
// try also dual eval tokenasks (and we do not need bids):
|
// try also dual eval tokenasks (and we do not need bids):
|
||||||
cpAssets->additionalTokensEvalcode2 = additionalEvalCode;
|
cpAssets->additionalTokensEvalcode2 = additionalEvalCode;
|
||||||
GetTokensCCaddress(cpAssets, assetsDualEvalTokensUnspendableAddr, GetUnspendable(cpAssets, NULL));
|
GetTokensCCaddress(cpAssets, assetsDualEvalTokensUnspendableAddr, GetUnspendable(cpAssets, NULL));
|
||||||
SetCCunspents(unspentOutputsDualEvalTokens, assetsDualEvalTokensUnspendableAddr);
|
SetCCunspents(unspentOutputsDualEvalTokens, assetsDualEvalTokensUnspendableAddr,true);
|
||||||
|
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator itDualEvalTokens = unspentOutputsDualEvalTokens.begin();
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator itDualEvalTokens = unspentOutputsDualEvalTokens.begin();
|
||||||
itDualEvalTokens != unspentOutputsDualEvalTokens.end();
|
itDualEvalTokens != unspentOutputsDualEvalTokens.end();
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ int32_t decode_hex(uint8_t *bytes,int32_t n,char *hex);
|
|||||||
int32_t iguana_rwnum(int32_t rwflag,uint8_t *serialized,int32_t len,void *endianedp);
|
int32_t iguana_rwnum(int32_t rwflag,uint8_t *serialized,int32_t len,void *endianedp);
|
||||||
int32_t iguana_rwbignum(int32_t rwflag,uint8_t *serialized,int32_t len,uint8_t *endianedp);
|
int32_t iguana_rwbignum(int32_t rwflag,uint8_t *serialized,int32_t len,uint8_t *endianedp);
|
||||||
CScript GetScriptForMultisig(int nRequired, const std::vector<CPubKey>& keys);
|
CScript GetScriptForMultisig(int nRequired, const std::vector<CPubKey>& keys);
|
||||||
int64_t CCaddress_balance(char *coinaddr);
|
int64_t CCaddress_balance(char *coinaddr,int32_t CCflag);
|
||||||
CPubKey CCtxidaddr(char *txidaddr,uint256 txid);
|
CPubKey CCtxidaddr(char *txidaddr,uint256 txid);
|
||||||
CPubKey CCCustomtxidaddr(char *txidaddr,uint256 txid,uint8_t taddr,uint8_t prefix,uint8_t prefix2);
|
CPubKey CCCustomtxidaddr(char *txidaddr,uint256 txid,uint8_t taddr,uint8_t prefix,uint8_t prefix2);
|
||||||
bool GetCCParams(Eval* eval, const CTransaction &tx, uint32_t nIn,
|
bool GetCCParams(Eval* eval, const CTransaction &tx, uint32_t nIn,
|
||||||
@@ -278,11 +278,11 @@ CPubKey check_signing_pubkey(CScript scriptSig);
|
|||||||
bool SignTx(CMutableTransaction &mtx,int32_t vini,int64_t utxovalue,const CScript scriptPubKey);
|
bool SignTx(CMutableTransaction &mtx,int32_t vini,int64_t utxovalue,const CScript scriptPubKey);
|
||||||
extern std::vector<CPubKey> NULL_pubkeys;
|
extern std::vector<CPubKey> NULL_pubkeys;
|
||||||
std::string FinalizeCCTx(uint64_t skipmask,struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKey mypk,uint64_t txfee,CScript opret,std::vector<CPubKey> pubkeys = NULL_pubkeys);
|
std::string FinalizeCCTx(uint64_t skipmask,struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKey mypk,uint64_t txfee,CScript opret,std::vector<CPubKey> pubkeys = NULL_pubkeys);
|
||||||
void SetCCunspents(std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > &unspentOutputs,char *coinaddr);
|
void SetCCunspents(std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > &unspentOutputs,char *coinaddr,bool CCflag = true);
|
||||||
void SetCCtxids(std::vector<std::pair<CAddressIndexKey, CAmount> > &addressIndex,char *coinaddr);
|
void SetCCtxids(std::vector<std::pair<CAddressIndexKey, CAmount> > &addressIndex,char *coinaddr,bool CCflag = true);
|
||||||
int64_t AddNormalinputs(CMutableTransaction &mtx,CPubKey mypk,int64_t total,int32_t maxinputs);
|
int64_t AddNormalinputs(CMutableTransaction &mtx,CPubKey mypk,int64_t total,int32_t maxinputs);
|
||||||
int64_t AddNormalinputs2(CMutableTransaction &mtx,int64_t total,int32_t maxinputs);
|
int64_t AddNormalinputs2(CMutableTransaction &mtx,int64_t total,int32_t maxinputs);
|
||||||
int64_t CCutxovalue(char *coinaddr,uint256 utxotxid,int32_t utxovout);
|
int64_t CCutxovalue(char *coinaddr,uint256 utxotxid,int32_t utxovout,int32_t CCflag);
|
||||||
|
|
||||||
// curve25519 and sha256
|
// curve25519 and sha256
|
||||||
bits256 curve25519_shared(bits256 privkey,bits256 otherpub);
|
bits256 curve25519_shared(bits256 privkey,bits256 otherpub);
|
||||||
|
|||||||
@@ -580,7 +580,7 @@ int64_t AddTokenCCInputs(struct CCcontract_info *cp, CMutableTransaction &mtx, C
|
|||||||
cp->additionalTokensEvalcode2 = vopretNonfungible.begin()[0];
|
cp->additionalTokensEvalcode2 = vopretNonfungible.begin()[0];
|
||||||
|
|
||||||
GetTokensCCaddress(cp, tokenaddr, pk);
|
GetTokensCCaddress(cp, tokenaddr, pk);
|
||||||
SetCCunspents(unspentOutputs, tokenaddr);
|
SetCCunspents(unspentOutputs, tokenaddr,true);
|
||||||
|
|
||||||
if (unspentOutputs.empty()) {
|
if (unspentOutputs.empty()) {
|
||||||
LOGSTREAM((char *)"cctokens", CCLOG_INFO, stream << "AddTokenCCInputs() no utxos for token dual/three eval addr=" << tokenaddr << " evalcode=" << (int)cp->evalcode << " additionalTokensEvalcode2=" << (int)cp->additionalTokensEvalcode2 << std::endl);
|
LOGSTREAM((char *)"cctokens", CCLOG_INFO, stream << "AddTokenCCInputs() no utxos for token dual/three eval addr=" << tokenaddr << " evalcode=" << (int)cp->evalcode << " additionalTokensEvalcode2=" << (int)cp->additionalTokensEvalcode2 << std::endl);
|
||||||
@@ -942,12 +942,12 @@ UniValue TokenList()
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
SetCCtxids(addressIndex, cp->normaladdr); // find by old normal addr marker
|
SetCCtxids(addressIndex, cp->normaladdr,false); // find by old normal addr marker
|
||||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it = addressIndex.begin(); it != addressIndex.end(); it++) {
|
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it = addressIndex.begin(); it != addressIndex.end(); it++) {
|
||||||
addTokenId(it->first.txhash);
|
addTokenId(it->first.txhash);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetCCunspents(addressIndexCCMarker, cp->unspendableCCaddr); // find by burnable validated cc addr marker
|
SetCCunspents(addressIndexCCMarker, cp->unspendableCCaddr,true); // find by burnable validated cc addr marker
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it = addressIndexCCMarker.begin(); it != addressIndexCCMarker.end(); it++) {
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it = addressIndexCCMarker.begin(); it != addressIndexCCMarker.end(); it++) {
|
||||||
addTokenId(it->first.txhash);
|
addTokenId(it->first.txhash);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -306,7 +306,7 @@ std::string FinalizeCCTx(uint64_t CCmask,struct CCcontract_info *cp,CMutableTran
|
|||||||
else return("0");
|
else return("0");
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetCCunspents(std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > &unspentOutputs,char *coinaddr)
|
void SetCCunspents(std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > &unspentOutputs,char *coinaddr,bool ccflag)
|
||||||
{
|
{
|
||||||
int32_t type=0,i,n; char *ptr; std::string addrstr; uint160 hashBytes; std::vector<std::pair<uint160, int> > addresses;
|
int32_t type=0,i,n; char *ptr; std::string addrstr; uint160 hashBytes; std::vector<std::pair<uint160, int> > addresses;
|
||||||
n = (int32_t)strlen(coinaddr);
|
n = (int32_t)strlen(coinaddr);
|
||||||
@@ -315,7 +315,7 @@ void SetCCunspents(std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValu
|
|||||||
for (i=0; i<=n; i++)
|
for (i=0; i<=n; i++)
|
||||||
ptr[i] = coinaddr[i];
|
ptr[i] = coinaddr[i];
|
||||||
CBitcoinAddress address(addrstr);
|
CBitcoinAddress address(addrstr);
|
||||||
if ( address.GetIndexKey(hashBytes, type) == 0 )
|
if ( address.GetIndexKey(hashBytes, type, ccflag) == 0 )
|
||||||
return;
|
return;
|
||||||
addresses.push_back(std::make_pair(hashBytes,type));
|
addresses.push_back(std::make_pair(hashBytes,type));
|
||||||
for (std::vector<std::pair<uint160, int> >::iterator it = addresses.begin(); it != addresses.end(); it++)
|
for (std::vector<std::pair<uint160, int> >::iterator it = addresses.begin(); it != addresses.end(); it++)
|
||||||
@@ -325,7 +325,7 @@ void SetCCunspents(std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetCCtxids(std::vector<std::pair<CAddressIndexKey, CAmount> > &addressIndex,char *coinaddr)
|
void SetCCtxids(std::vector<std::pair<CAddressIndexKey, CAmount> > &addressIndex,char *coinaddr,bool ccflag)
|
||||||
{
|
{
|
||||||
int32_t type=0,i,n; char *ptr; std::string addrstr; uint160 hashBytes; std::vector<std::pair<uint160, int> > addresses;
|
int32_t type=0,i,n; char *ptr; std::string addrstr; uint160 hashBytes; std::vector<std::pair<uint160, int> > addresses;
|
||||||
n = (int32_t)strlen(coinaddr);
|
n = (int32_t)strlen(coinaddr);
|
||||||
@@ -334,7 +334,7 @@ void SetCCtxids(std::vector<std::pair<CAddressIndexKey, CAmount> > &addressIndex
|
|||||||
for (i=0; i<=n; i++)
|
for (i=0; i<=n; i++)
|
||||||
ptr[i] = coinaddr[i];
|
ptr[i] = coinaddr[i];
|
||||||
CBitcoinAddress address(addrstr);
|
CBitcoinAddress address(addrstr);
|
||||||
if ( address.GetIndexKey(hashBytes, type) == 0 )
|
if ( address.GetIndexKey(hashBytes, type, ccflag) == 0 )
|
||||||
return;
|
return;
|
||||||
addresses.push_back(std::make_pair(hashBytes,type));
|
addresses.push_back(std::make_pair(hashBytes,type));
|
||||||
for (std::vector<std::pair<uint160, int> >::iterator it = addresses.begin(); it != addresses.end(); it++)
|
for (std::vector<std::pair<uint160, int> >::iterator it = addresses.begin(); it != addresses.end(); it++)
|
||||||
@@ -344,10 +344,10 @@ void SetCCtxids(std::vector<std::pair<CAddressIndexKey, CAmount> > &addressIndex
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t CCutxovalue(char *coinaddr,uint256 utxotxid,int32_t utxovout)
|
int64_t CCutxovalue(char *coinaddr,uint256 utxotxid,int32_t utxovout,int32_t CCflag)
|
||||||
{
|
{
|
||||||
uint256 txid; std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
uint256 txid; std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,CCflag!=0?true:false);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
@@ -403,10 +403,10 @@ int32_t CCgetspenttxid(uint256 &spenttxid,int32_t &vini,int32_t &height,uint256
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t CCaddress_balance(char *coinaddr)
|
int64_t CCaddress_balance(char *coinaddr,int32_t CCflag)
|
||||||
{
|
{
|
||||||
int64_t sum = 0; std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
int64_t sum = 0; std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,CCflag!=0?true:false);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
sum += it->second.satoshis;
|
sum += it->second.satoshis;
|
||||||
@@ -434,7 +434,7 @@ int64_t CCtoken_balance(char *coinaddr,uint256 reftokenid)
|
|||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||||
uint8_t evalCode;
|
uint8_t evalCode;
|
||||||
|
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
@@ -613,7 +613,7 @@ int64_t AddNormalinputs2(CMutableTransaction &mtx,int64_t total,int32_t maxinput
|
|||||||
else threshold = total;
|
else threshold = total;
|
||||||
sum = 0;
|
sum = 0;
|
||||||
Getscriptaddress(coinaddr,CScript() << Mypubkey() << OP_CHECKSIG);
|
Getscriptaddress(coinaddr,CScript() << Mypubkey() << OP_CHECKSIG);
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,false);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
|
|||||||
@@ -600,7 +600,7 @@ int32_t CCCointxidExists(char const *logcategory,uint256 cointxid)
|
|||||||
char txidaddr[64]; std::string coin; int32_t numvouts; uint256 hashBlock;
|
char txidaddr[64]; std::string coin; int32_t numvouts; uint256 hashBlock;
|
||||||
std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex;
|
std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex;
|
||||||
CCtxidaddr(txidaddr,cointxid);
|
CCtxidaddr(txidaddr,cointxid);
|
||||||
SetCCtxids(addressIndex,txidaddr);
|
SetCCtxids(addressIndex,txidaddr,true);
|
||||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
||||||
{
|
{
|
||||||
return(-1);
|
return(-1);
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ int64_t AddAuctionInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPu
|
|||||||
char coinaddr[64]; int64_t nValue,price,totalinputs = 0; uint256 txid,hashBlock; std::vector<uint8_t> origpubkey; CTransaction vintx; int32_t n = 0;
|
char coinaddr[64]; int64_t nValue,price,totalinputs = 0; uint256 txid,hashBlock; std::vector<uint8_t> origpubkey; CTransaction vintx; int32_t n = 0;
|
||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||||
GetCCaddress(cp,coinaddr,pk);
|
GetCCaddress(cp,coinaddr,pk);
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
|
|||||||
@@ -482,7 +482,7 @@ bool CClib_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const C
|
|||||||
else if ( (hash[0] & 0xff) != 0 || (hash[31] & 0xff) != 0 )
|
else if ( (hash[0] & 0xff) != 0 || (hash[31] & 0xff) != 0 )
|
||||||
return eval->Invalid("invalid faucetget txid");
|
return eval->Invalid("invalid faucetget txid");
|
||||||
Getscriptaddress(destaddr,tx.vout[i].scriptPubKey);
|
Getscriptaddress(destaddr,tx.vout[i].scriptPubKey);
|
||||||
SetCCtxids(txids,destaddr);
|
SetCCtxids(txids,destaddr,tx.vout[i].scriptPubKey.IsPayToCryptoCondition());
|
||||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=txids.begin(); it!=txids.end(); it++)
|
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=txids.begin(); it!=txids.end(); it++)
|
||||||
{
|
{
|
||||||
//int height = it->first.blockHeight;
|
//int height = it->first.blockHeight;
|
||||||
@@ -501,12 +501,12 @@ bool CClib_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const C
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t AddCClibInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKey pk,int64_t total,int32_t maxinputs,char *cmpaddr)
|
int64_t AddCClibInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKey pk,int64_t total,int32_t maxinputs,char *cmpaddr,int32_t CCflag)
|
||||||
{
|
{
|
||||||
char coinaddr[64]; int64_t threshold,nValue,price,totalinputs = 0,txfee = 10000; uint256 txid,hashBlock; std::vector<uint8_t> origpubkey; CTransaction vintx; int32_t vout,n = 0;
|
char coinaddr[64]; int64_t threshold,nValue,price,totalinputs = 0,txfee = 10000; uint256 txid,hashBlock; std::vector<uint8_t> origpubkey; CTransaction vintx; int32_t vout,n = 0;
|
||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||||
GetCCaddress(cp,coinaddr,pk);
|
GetCCaddress(cp,coinaddr,pk);
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,CCflag!=0?true:false);
|
||||||
if ( maxinputs > CC_MAXVINS )
|
if ( maxinputs > CC_MAXVINS )
|
||||||
maxinputs = CC_MAXVINS;
|
maxinputs = CC_MAXVINS;
|
||||||
if ( maxinputs != 0 )
|
if ( maxinputs != 0 )
|
||||||
@@ -542,7 +542,7 @@ int64_t AddCClibtxfee(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKe
|
|||||||
char coinaddr[64]; int64_t nValue,txfee = 10000; uint256 txid,hashBlock; CTransaction vintx; int32_t vout;
|
char coinaddr[64]; int64_t nValue,txfee = 10000; uint256 txid,hashBlock; CTransaction vintx; int32_t vout;
|
||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||||
GetCCaddress(cp,coinaddr,pk);
|
GetCCaddress(cp,coinaddr,pk);
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
@@ -596,7 +596,7 @@ std::string CClib_rawtxgen(struct CCcontract_info *cp,uint8_t funcid,cJSON *para
|
|||||||
return("");
|
return("");
|
||||||
cclibpk = GetUnspendable(cp,0);
|
cclibpk = GetUnspendable(cp,0);
|
||||||
mypk = pubkey2pk(Mypubkey());
|
mypk = pubkey2pk(Mypubkey());
|
||||||
if ( (inputs= AddCClibInputs(cp,mtx,cclibpk,nValue+txfee,60,cp->unspendableCCaddr)) > 0 )
|
if ( (inputs= AddCClibInputs(cp,mtx,cclibpk,nValue+txfee,60,cp->unspendableCCaddr,1)) > 0 )
|
||||||
{
|
{
|
||||||
if ( inputs > nValue )
|
if ( inputs > nValue )
|
||||||
CCchange = (inputs - nValue - txfee);
|
CCchange = (inputs - nValue - txfee);
|
||||||
|
|||||||
@@ -411,7 +411,7 @@ int64_t AddChannelsInputs(struct CCcontract_info *cp,CMutableTransaction &mtx, C
|
|||||||
{
|
{
|
||||||
if (tokenid!=zeroid) GetTokensCCaddress1of2(cp,coinaddr,srcpub,destpub);
|
if (tokenid!=zeroid) GetTokensCCaddress1of2(cp,coinaddr,srcpub,destpub);
|
||||||
else GetCCaddress1of2(cp,coinaddr,srcpub,destpub);
|
else GetCCaddress1of2(cp,coinaddr,srcpub,destpub);
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -797,7 +797,7 @@ UniValue ChannelsList()
|
|||||||
cp = CCinit(&C,EVAL_CHANNELS);
|
cp = CCinit(&C,EVAL_CHANNELS);
|
||||||
mypk = pubkey2pk(Mypubkey());
|
mypk = pubkey2pk(Mypubkey());
|
||||||
GetCCaddress(cp,myCCaddr,mypk);
|
GetCCaddress(cp,myCCaddr,mypk);
|
||||||
SetCCtxids(txids,myCCaddr);
|
SetCCtxids(txids,myCCaddr,true);
|
||||||
result.push_back(Pair("result","success"));
|
result.push_back(Pair("result","success"));
|
||||||
result.push_back(Pair("name","Channels List"));
|
result.push_back(Pair("name","Channels List"));
|
||||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=txids.begin(); it!=txids.end(); it++)
|
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=txids.begin(); it!=txids.end(); it++)
|
||||||
@@ -848,7 +848,7 @@ UniValue ChannelsInfo(uint256 channeltxid)
|
|||||||
result.push_back(Pair("Denomination (satoshi)",i64tostr(param2)));
|
result.push_back(Pair("Denomination (satoshi)",i64tostr(param2)));
|
||||||
result.push_back(Pair("Amount (satoshi)",i64tostr(param1*param2)));
|
result.push_back(Pair("Amount (satoshi)",i64tostr(param1*param2)));
|
||||||
}
|
}
|
||||||
SetCCtxids(addressIndex,CCaddr);
|
SetCCtxids(addressIndex,CCaddr,true);
|
||||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
||||||
{
|
{
|
||||||
if (GetTransaction(it->first.txhash,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 0 )
|
if (GetTransaction(it->first.txhash,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 0 )
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ int32_t dicefinish_utxosget(int32_t &total,struct dicefinish_utxo *utxos,int32_t
|
|||||||
int32_t n = 0; int64_t threshold = 2 * 10000;
|
int32_t n = 0; int64_t threshold = 2 * 10000;
|
||||||
total = 0;
|
total = 0;
|
||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,false);
|
||||||
{
|
{
|
||||||
LOCK(mempool.cs);
|
LOCK(mempool.cs);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
@@ -1051,7 +1051,7 @@ uint64_t AddDiceInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubK
|
|||||||
char coinaddr[64],str[65]; uint64_t threshold,sbits,nValue,totalinputs = 0; uint256 txid,hash,proof,hashBlock,fundingtxid; CTransaction tx; int32_t j,vout,n = 0; uint8_t funcid;
|
char coinaddr[64],str[65]; uint64_t threshold,sbits,nValue,totalinputs = 0; uint256 txid,hash,proof,hashBlock,fundingtxid; CTransaction tx; int32_t j,vout,n = 0; uint8_t funcid;
|
||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||||
GetCCaddress(cp,coinaddr,pk);
|
GetCCaddress(cp,coinaddr,pk);
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
if ( maxinputs > CC_MAXVINS )
|
if ( maxinputs > CC_MAXVINS )
|
||||||
maxinputs = CC_MAXVINS;
|
maxinputs = CC_MAXVINS;
|
||||||
if ( maxinputs > 0 )
|
if ( maxinputs > 0 )
|
||||||
@@ -1108,7 +1108,7 @@ int64_t DicePlanFunds(uint64_t &entropyval,uint256 &entropytxid,uint64_t refsbit
|
|||||||
fundingPubKey = tx.vout[1].scriptPubKey;
|
fundingPubKey = tx.vout[1].scriptPubKey;
|
||||||
} else return(0);
|
} else return(0);
|
||||||
GetCCaddress(cp,coinaddr,dicepk);
|
GetCCaddress(cp,coinaddr,dicepk);
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
entropyval = 0;
|
entropyval = 0;
|
||||||
int loops = 0;
|
int loops = 0;
|
||||||
int numtxs = unspentOutputs.size()/2;
|
int numtxs = unspentOutputs.size()/2;
|
||||||
@@ -1225,7 +1225,7 @@ bool DicePlanExists(CScript &fundingPubKey,uint256 &fundingtxid,struct CCcontrac
|
|||||||
char CCaddr[64]; uint64_t sbits=0; uint256 txid,hashBlock; CTransaction tx;
|
char CCaddr[64]; uint64_t sbits=0; uint256 txid,hashBlock; CTransaction tx;
|
||||||
std::vector<std::pair<CAddressIndexKey, CAmount> > txids;
|
std::vector<std::pair<CAddressIndexKey, CAmount> > txids;
|
||||||
GetCCaddress(cp,CCaddr,dicepk);
|
GetCCaddress(cp,CCaddr,dicepk);
|
||||||
SetCCtxids(txids,cp->normaladdr);
|
SetCCtxids(txids,cp->normaladdr,false);
|
||||||
if ( fundingtxid != zeroid ) // avoid scan unless creating new funding plan
|
if ( fundingtxid != zeroid ) // avoid scan unless creating new funding plan
|
||||||
{
|
{
|
||||||
//fprintf(stderr,"check fundingtxid\n");
|
//fprintf(stderr,"check fundingtxid\n");
|
||||||
@@ -1321,7 +1321,7 @@ UniValue DiceList()
|
|||||||
{
|
{
|
||||||
UniValue result(UniValue::VARR); std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex; struct CCcontract_info *cp,C; uint256 txid,hashBlock; CTransaction vintx; uint64_t sbits; int64_t minbet,maxbet,maxodds,timeoutblocks; char str[65];
|
UniValue result(UniValue::VARR); std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex; struct CCcontract_info *cp,C; uint256 txid,hashBlock; CTransaction vintx; uint64_t sbits; int64_t minbet,maxbet,maxodds,timeoutblocks; char str[65];
|
||||||
cp = CCinit(&C,EVAL_DICE);
|
cp = CCinit(&C,EVAL_DICE);
|
||||||
SetCCtxids(addressIndex,cp->normaladdr);
|
SetCCtxids(addressIndex,cp->normaladdr,false);
|
||||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
@@ -1774,7 +1774,7 @@ double DiceStatus(uint64_t txfee,char *planstr,uint256 fundingtxid,uint256 bettx
|
|||||||
return(0.);
|
return(0.);
|
||||||
}
|
}
|
||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
|
|||||||
@@ -3341,7 +3341,7 @@ int64_t dilithium_inputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPu
|
|||||||
char coinaddr[64]; int64_t threshold,nValue,price,totalinputs = 0; uint256 checktxid,txid,hashBlock; std::vector<uint8_t> origpubkey,tmpsig; CTransaction vintx; int32_t vout,numvouts,n = 0; std::vector<uint256> voutpubtxids;
|
char coinaddr[64]; int64_t threshold,nValue,price,totalinputs = 0; uint256 checktxid,txid,hashBlock; std::vector<uint8_t> origpubkey,tmpsig; CTransaction vintx; int32_t vout,numvouts,n = 0; std::vector<uint256> voutpubtxids;
|
||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||||
GetCCaddress(cp,coinaddr,pk);
|
GetCCaddress(cp,coinaddr,pk);
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
if ( maxinputs > CC_MAXVINS )
|
if ( maxinputs > CC_MAXVINS )
|
||||||
maxinputs = CC_MAXVINS;
|
maxinputs = CC_MAXVINS;
|
||||||
if ( maxinputs > 0 )
|
if ( maxinputs > 0 )
|
||||||
@@ -3538,7 +3538,7 @@ void dilithium_handleinit(struct CCcontract_info *cp)
|
|||||||
pthread_mutex_init(&DILITHIUM_MUTEX,NULL);
|
pthread_mutex_init(&DILITHIUM_MUTEX,NULL);
|
||||||
dilithiumpk = GetUnspendable(cp,0);
|
dilithiumpk = GetUnspendable(cp,0);
|
||||||
GetCCaddress(cp,CCaddr,dilithiumpk);
|
GetCCaddress(cp,CCaddr,dilithiumpk);
|
||||||
SetCCtxids(txids,CCaddr);
|
SetCCtxids(txids,CCaddr,true);
|
||||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=txids.begin(); it!=txids.end(); it++)
|
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=txids.begin(); it!=txids.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ bool FaucetValidate(struct CCcontract_info *cp,Eval* eval,const CTransaction &tx
|
|||||||
else if ( (hash[0] & 0xff) != 0 || (hash[31] & 0xff) != 0 )
|
else if ( (hash[0] & 0xff) != 0 || (hash[31] & 0xff) != 0 )
|
||||||
return eval->Invalid("invalid faucetget txid");
|
return eval->Invalid("invalid faucetget txid");
|
||||||
Getscriptaddress(destaddr,tx.vout[i].scriptPubKey);
|
Getscriptaddress(destaddr,tx.vout[i].scriptPubKey);
|
||||||
SetCCtxids(txids,destaddr);
|
SetCCtxids(txids,destaddr,tx.vout[i].scriptPubKey.IsPayToCryptoCondition());
|
||||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=txids.begin(); it!=txids.end(); it++)
|
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=txids.begin(); it!=txids.end(); it++)
|
||||||
{
|
{
|
||||||
//int height = it->first.blockHeight;
|
//int height = it->first.blockHeight;
|
||||||
@@ -145,7 +145,7 @@ int64_t AddFaucetInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPub
|
|||||||
char coinaddr[64]; int64_t threshold,nValue,price,totalinputs = 0; uint256 txid,hashBlock; std::vector<uint8_t> origpubkey; CTransaction vintx; int32_t vout,n = 0;
|
char coinaddr[64]; int64_t threshold,nValue,price,totalinputs = 0; uint256 txid,hashBlock; std::vector<uint8_t> origpubkey; CTransaction vintx; int32_t vout,n = 0;
|
||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||||
GetCCaddress(cp,coinaddr,pk);
|
GetCCaddress(cp,coinaddr,pk);
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
if ( maxinputs > CC_MAXVINS )
|
if ( maxinputs > CC_MAXVINS )
|
||||||
maxinputs = CC_MAXVINS;
|
maxinputs = CC_MAXVINS;
|
||||||
if ( maxinputs > 0 )
|
if ( maxinputs > 0 )
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ int64_t AddFSMInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKey
|
|||||||
char coinaddr[64]; int64_t nValue,price,totalinputs = 0; uint256 txid,hashBlock; std::vector<uint8_t> origpubkey; CTransaction vintx; int32_t n = 0;
|
char coinaddr[64]; int64_t nValue,price,totalinputs = 0; uint256 txid,hashBlock; std::vector<uint8_t> origpubkey; CTransaction vintx; int32_t n = 0;
|
||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||||
GetCCaddress(cp,coinaddr,pk);
|
GetCCaddress(cp,coinaddr,pk);
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
|
|||||||
@@ -1130,7 +1130,7 @@ UniValue games_newgame(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
|||||||
gamespk = GetUnspendable(cp,0);
|
gamespk = GetUnspendable(cp,0);
|
||||||
games_univalue(result,"newgame",maxplayers,buyin);
|
games_univalue(result,"newgame",maxplayers,buyin);
|
||||||
required = (3*txfee + maxplayers*(GAMES_REGISTRATIONSIZE+txfee));
|
required = (3*txfee + maxplayers*(GAMES_REGISTRATIONSIZE+txfee));
|
||||||
if ( (inputsum= AddCClibInputs(cp,mtx,gamespk,required,16,cp->unspendableCCaddr)) >= required )
|
if ( (inputsum= AddCClibInputs(cp,mtx,gamespk,required,16,cp->unspendableCCaddr,1)) >= required )
|
||||||
{
|
{
|
||||||
mtx.vout.push_back(MakeCC1vout(cp->evalcode,txfee,gamespk));
|
mtx.vout.push_back(MakeCC1vout(cp->evalcode,txfee,gamespk));
|
||||||
for (i=0; i<maxplayers; i++)
|
for (i=0; i<maxplayers; i++)
|
||||||
@@ -1152,7 +1152,7 @@ UniValue games_pending(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
|||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||||
gamespk = GetUnspendable(cp,0);
|
gamespk = GetUnspendable(cp,0);
|
||||||
GetCCaddress(cp,coinaddr,gamespk);
|
GetCCaddress(cp,coinaddr,gamespk);
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
nextheight = komodo_nextheight();
|
nextheight = komodo_nextheight();
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
@@ -1583,7 +1583,7 @@ UniValue games_finish(uint64_t txfee,struct CCcontract_info *cp,cJSON *params,ch
|
|||||||
}
|
}
|
||||||
if ( cashout > 0 )
|
if ( cashout > 0 )
|
||||||
{
|
{
|
||||||
if ( (inputsum= AddCClibInputs(cp,mtx,gamespk,cashout,60,cp->unspendableCCaddr)) > cashout )
|
if ( (inputsum= AddCClibInputs(cp,mtx,gamespk,cashout,60,cp->unspendableCCaddr,1)) > cashout )
|
||||||
CCchange = (inputsum - cashout);
|
CCchange = (inputsum - cashout);
|
||||||
else fprintf(stderr,"couldnt find enough utxos\n");
|
else fprintf(stderr,"couldnt find enough utxos\n");
|
||||||
}
|
}
|
||||||
@@ -1638,7 +1638,7 @@ UniValue games_players(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
|||||||
gamespk = GetUnspendable(cp,0);
|
gamespk = GetUnspendable(cp,0);
|
||||||
mypk = pubkey2pk(Mypubkey());
|
mypk = pubkey2pk(Mypubkey());
|
||||||
GetTokensCCaddress(cp,coinaddr,mypk);
|
GetTokensCCaddress(cp,coinaddr,mypk);
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
games_univalue(result,"players",-1,-1);
|
games_univalue(result,"players",-1,-1);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
@@ -1665,7 +1665,7 @@ UniValue games_games(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
|||||||
gamespk = GetUnspendable(cp,0);
|
gamespk = GetUnspendable(cp,0);
|
||||||
mypk = pubkey2pk(Mypubkey());
|
mypk = pubkey2pk(Mypubkey());
|
||||||
GetCCaddress1of2(cp,coinaddr,gamespk,mypk);
|
GetCCaddress1of2(cp,coinaddr,gamespk,mypk);
|
||||||
SetCCtxids(addressIndex,coinaddr);
|
SetCCtxids(addressIndex,coinaddr,true);
|
||||||
games_univalue(result,"games",-1,-1);
|
games_univalue(result,"games",-1,-1);
|
||||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -484,7 +484,7 @@ int32_t GatewaysBindExists(struct CCcontract_info *cp,CPubKey gatewayspk,uint256
|
|||||||
std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex;
|
std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex;
|
||||||
|
|
||||||
_GetCCaddress(markeraddr,EVAL_GATEWAYS,gatewayspk);
|
_GetCCaddress(markeraddr,EVAL_GATEWAYS,gatewayspk);
|
||||||
SetCCtxids(addressIndex,markeraddr);
|
SetCCtxids(addressIndex,markeraddr,true);
|
||||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
||||||
{
|
{
|
||||||
if ( myGetTransaction(it->first.txhash,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 0 && DecodeGatewaysOpRet(tx.vout[numvouts-1].scriptPubKey)=='B' )
|
if ( myGetTransaction(it->first.txhash,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 0 && DecodeGatewaysOpRet(tx.vout[numvouts-1].scriptPubKey)=='B' )
|
||||||
@@ -831,7 +831,7 @@ int64_t AddGatewaysInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CP
|
|||||||
if ((numvouts=bindtx.vout.size())!=0 && DecodeGatewaysBindOpRet(depositaddr,bindtx.vout[numvouts-1].scriptPubKey,tokenid,refcoin,totalsupply,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype) == 'B')
|
if ((numvouts=bindtx.vout.size())!=0 && DecodeGatewaysBindOpRet(depositaddr,bindtx.vout[numvouts-1].scriptPubKey,tokenid,refcoin,totalsupply,oracletxid,M,N,pubkeys,taddr,prefix,prefix2,wiftype) == 'B')
|
||||||
{
|
{
|
||||||
GetTokensCCaddress(cp,coinaddr,pk);
|
GetTokensCCaddress(cp,coinaddr,pk);
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
if ( maxinputs > CC_MAXVINS )
|
if ( maxinputs > CC_MAXVINS )
|
||||||
maxinputs = CC_MAXVINS;
|
maxinputs = CC_MAXVINS;
|
||||||
if ( maxinputs > 0 )
|
if ( maxinputs > 0 )
|
||||||
@@ -905,7 +905,7 @@ std::string GatewaysBind(uint64_t txfee,std::string coin,uint256 tokenid,int64_t
|
|||||||
for (i=0; i<N; i++)
|
for (i=0; i<N; i++)
|
||||||
{
|
{
|
||||||
Getscriptaddress(coinaddr,CScript() << ParseHex(HexStr(pubkeys[i])) << OP_CHECKSIG);
|
Getscriptaddress(coinaddr,CScript() << ParseHex(HexStr(pubkeys[i])) << OP_CHECKSIG);
|
||||||
if ( CCaddress_balance(coinaddr) == 0 )
|
if ( CCaddress_balance(coinaddr,0) == 0 )
|
||||||
{
|
{
|
||||||
CCerror = strprintf("M.%d N.%d but pubkeys[%d] has no balance",M,N,i);
|
CCerror = strprintf("M.%d N.%d but pubkeys[%d] has no balance",M,N,i);
|
||||||
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
|
LOGSTREAM("gatewayscc",CCLOG_INFO, stream << CCerror << std::endl);
|
||||||
@@ -1160,7 +1160,7 @@ std::string GatewaysWithdraw(uint64_t txfee,uint256 bindtxid,std::string refcoin
|
|||||||
return("");
|
return("");
|
||||||
}
|
}
|
||||||
_GetCCaddress(coinaddr,EVAL_GATEWAYS,gatewayspk);
|
_GetCCaddress(coinaddr,EVAL_GATEWAYS,gatewayspk);
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
@@ -1500,7 +1500,7 @@ UniValue GatewaysPendingDeposits(uint256 bindtxid,std::string refcoin)
|
|||||||
result.push_back(Pair("error",strprintf("invalid bindtxid %s coin.%s",uint256_str(str,bindtxid),coin.c_str())));
|
result.push_back(Pair("error",strprintf("invalid bindtxid %s coin.%s",uint256_str(str,bindtxid),coin.c_str())));
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
@@ -1563,7 +1563,7 @@ UniValue GatewaysPendingWithdraws(uint256 bindtxid,std::string refcoin)
|
|||||||
queueflag = 1;
|
queueflag = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
@@ -1651,7 +1651,7 @@ UniValue GatewaysProcessedWithdraws(uint256 bindtxid,std::string refcoin)
|
|||||||
queueflag = 1;
|
queueflag = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
@@ -1688,7 +1688,7 @@ UniValue GatewaysList()
|
|||||||
{
|
{
|
||||||
UniValue result(UniValue::VARR); std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex; struct CCcontract_info *cp,C; uint256 txid,hashBlock,oracletxid,tokenid; CTransaction vintx; std::string coin; int64_t totalsupply; char str[65],depositaddr[64]; uint8_t M,N,taddr,prefix,prefix2,wiftype; std::vector<CPubKey> pubkeys;
|
UniValue result(UniValue::VARR); std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex; struct CCcontract_info *cp,C; uint256 txid,hashBlock,oracletxid,tokenid; CTransaction vintx; std::string coin; int64_t totalsupply; char str[65],depositaddr[64]; uint8_t M,N,taddr,prefix,prefix2,wiftype; std::vector<CPubKey> pubkeys;
|
||||||
cp = CCinit(&C,EVAL_GATEWAYS);
|
cp = CCinit(&C,EVAL_GATEWAYS);
|
||||||
SetCCtxids(addressIndex,cp->unspendableCCaddr);
|
SetCCtxids(addressIndex,cp->unspendableCCaddr,true);
|
||||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
|
|||||||
@@ -399,7 +399,7 @@ uint256 _FindLatestFundingTx(uint256 fundingtxid, uint8_t& funcId, uint256 &toke
|
|||||||
|
|
||||||
//char markeraddr[64];
|
//char markeraddr[64];
|
||||||
//CCtxidaddr(markeraddr, fundingtxid);
|
//CCtxidaddr(markeraddr, fundingtxid);
|
||||||
//SetCCunspents(unspentOutputs, markeraddr);
|
//SetCCunspents(unspentOutputs, markeraddr,true);
|
||||||
|
|
||||||
hasHeirSpendingBegun = 0;
|
hasHeirSpendingBegun = 0;
|
||||||
funcId = 0;
|
funcId = 0;
|
||||||
@@ -429,7 +429,7 @@ uint256 _FindLatestFundingTx(uint256 fundingtxid, uint8_t& funcId, uint256 &toke
|
|||||||
char coinaddr[64];
|
char coinaddr[64];
|
||||||
GetCCaddress1of2(cp, coinaddr, ownerPubkey, heirPubkey); // get the address of cryptocondition '1 of 2 pubkeys'
|
GetCCaddress1of2(cp, coinaddr, ownerPubkey, heirPubkey); // get the address of cryptocondition '1 of 2 pubkeys'
|
||||||
|
|
||||||
SetCCunspents(unspentOutputs, coinaddr); // get vector with tx's with unspent vouts of 1of2pubkey address:
|
SetCCunspents(unspentOutputs, coinaddr,true); // get vector with tx's with unspent vouts of 1of2pubkey address:
|
||||||
//std::cerr << "FindLatestFundingTx() using 1of2address=" << coinaddr << " unspentOutputs.size()=" << unspentOutputs.size() << '\n';
|
//std::cerr << "FindLatestFundingTx() using 1of2address=" << coinaddr << " unspentOutputs.size()=" << unspentOutputs.size() << '\n';
|
||||||
|
|
||||||
int32_t maxBlockHeight = 0; // max block height
|
int32_t maxBlockHeight = 0; // max block height
|
||||||
@@ -514,11 +514,11 @@ template <class Helper> int64_t Add1of2AddressInputs(struct CCcontract_info* cp,
|
|||||||
|
|
||||||
char coinaddr[64];
|
char coinaddr[64];
|
||||||
Helper::GetCoinsOrTokensCCaddress1of2(coinaddr, ownerPubkey, heirPubkey); // get address of cryptocondition '1 of 2 pubkeys'
|
Helper::GetCoinsOrTokensCCaddress1of2(coinaddr, ownerPubkey, heirPubkey); // get address of cryptocondition '1 of 2 pubkeys'
|
||||||
SetCCunspents(unspentOutputs, coinaddr);
|
SetCCunspents(unspentOutputs, coinaddr,true);
|
||||||
|
|
||||||
// char markeraddr[64];
|
// char markeraddr[64];
|
||||||
// CCtxidaddr(markeraddr, fundingtxid);
|
// CCtxidaddr(markeraddr, fundingtxid);
|
||||||
// SetCCunspents(unspentOutputs, markeraddr);
|
// SetCCunspents(unspentOutputs, markeraddr,true);
|
||||||
|
|
||||||
std::cerr << "Add1of2AddressInputs() using 1of2addr=" << coinaddr << " unspentOutputs.size()=" << unspentOutputs.size() << std::endl;
|
std::cerr << "Add1of2AddressInputs() using 1of2addr=" << coinaddr << " unspentOutputs.size()=" << unspentOutputs.size() << std::endl;
|
||||||
|
|
||||||
@@ -569,7 +569,7 @@ template <class Helper> int64_t LifetimeHeirContractFunds(struct CCcontract_info
|
|||||||
Helper::GetCoinsOrTokensCCaddress1of2(coinaddr, ownerPubkey, heirPubkey); // get the address of cryptocondition '1 of 2 pubkeys'
|
Helper::GetCoinsOrTokensCCaddress1of2(coinaddr, ownerPubkey, heirPubkey); // get the address of cryptocondition '1 of 2 pubkeys'
|
||||||
|
|
||||||
std::vector<std::pair<CAddressIndexKey, CAmount>> addressIndexes;
|
std::vector<std::pair<CAddressIndexKey, CAmount>> addressIndexes;
|
||||||
SetCCtxids(addressIndexes, coinaddr);
|
SetCCtxids(addressIndexes, coinaddr,true);
|
||||||
|
|
||||||
//fprintf(stderr,"LifetimeHeirContractFunds() scan lifetime of %s\n",coinaddr);
|
//fprintf(stderr,"LifetimeHeirContractFunds() scan lifetime of %s\n",coinaddr);
|
||||||
int64_t total = 0;
|
int64_t total = 0;
|
||||||
@@ -1053,7 +1053,7 @@ UniValue HeirInfo(uint256 fundingtxid)
|
|||||||
|
|
||||||
//char markeraddr[64];
|
//char markeraddr[64];
|
||||||
//CCtxidaddr(markeraddr, fundingtxid);
|
//CCtxidaddr(markeraddr, fundingtxid);
|
||||||
//SetCCunspents(unspentOutputs, markeraddr);
|
//SetCCunspents(unspentOutputs, markeraddr,true);
|
||||||
|
|
||||||
// get initial funding tx and set it as initial lasttx:
|
// get initial funding tx and set it as initial lasttx:
|
||||||
if (myGetTransaction(fundingtxid, fundingtx, hashBlock) && fundingtx.vout.size()) {
|
if (myGetTransaction(fundingtxid, fundingtx, hashBlock) && fundingtx.vout.size()) {
|
||||||
@@ -1218,7 +1218,7 @@ void _HeirList(struct CCcontract_info *cp, UniValue &result)
|
|||||||
char markeraddr[64];
|
char markeraddr[64];
|
||||||
|
|
||||||
GetCCaddress(cp, markeraddr, GetUnspendable(cp, NULL));
|
GetCCaddress(cp, markeraddr, GetUnspendable(cp, NULL));
|
||||||
SetCCunspents(unspentOutputs, markeraddr);
|
SetCCunspents(unspentOutputs, markeraddr,true);
|
||||||
|
|
||||||
//std::cerr << "HeirList() finding heir marker from unspendable addr=" << markeraddr << " unspentOutputs.size()=" << unspentOutputs.size() << '\n';
|
//std::cerr << "HeirList() finding heir marker from unspendable addr=" << markeraddr << " unspentOutputs.size()=" << unspentOutputs.size() << '\n';
|
||||||
|
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ bool ImportCoinGatewaysVerify(CTransaction oracletx, int32_t claimvout, std::str
|
|||||||
// return("");
|
// return("");
|
||||||
// }
|
// }
|
||||||
// CCtxidaddr(markeraddr,oracletxid);
|
// CCtxidaddr(markeraddr,oracletxid);
|
||||||
// SetCCunspents(unspentOutputs,markeraddr);
|
// SetCCunspents(unspentOutputs,markeraddr,true);
|
||||||
// for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
// for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
// {
|
// {
|
||||||
// txid = it->first.txhash;
|
// txid = it->first.txhash;
|
||||||
@@ -478,7 +478,7 @@ int32_t CheckGATEWAYimport(CTransaction importTx,CTransaction burnTx,std::string
|
|||||||
// return(-1);
|
// return(-1);
|
||||||
// }
|
// }
|
||||||
// CCtxidaddr(markeraddr,oracletxid);
|
// CCtxidaddr(markeraddr,oracletxid);
|
||||||
// SetCCunspents(unspentOutputs,markeraddr);
|
// SetCCunspents(unspentOutputs,markeraddr,true);
|
||||||
// for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
// for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
// {
|
// {
|
||||||
// txid = it->first.txhash;
|
// txid = it->first.txhash;
|
||||||
|
|||||||
@@ -261,7 +261,7 @@ int32_t ImportGatewayBindExists(struct CCcontract_info *cp,CPubKey importgateway
|
|||||||
std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex;
|
std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex;
|
||||||
|
|
||||||
_GetCCaddress(markeraddr,EVAL_IMPORTGATEWAY,importgatewaypk);
|
_GetCCaddress(markeraddr,EVAL_IMPORTGATEWAY,importgatewaypk);
|
||||||
SetCCtxids(addressIndex,markeraddr);
|
SetCCtxids(addressIndex,markeraddr,true);
|
||||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
||||||
{
|
{
|
||||||
if ( myGetTransaction(it->first.txhash,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 0 && DecodeImportGatewayOpRet(tx.vout[numvouts-1].scriptPubKey)=='B' )
|
if ( myGetTransaction(it->first.txhash,tx,hashBlock) != 0 && (numvouts= tx.vout.size()) > 0 && DecodeImportGatewayOpRet(tx.vout[numvouts-1].scriptPubKey)=='B' )
|
||||||
@@ -505,7 +505,7 @@ std::string ImportGatewayBind(uint64_t txfee,std::string coin,uint256 oracletxid
|
|||||||
for (i=0; i<N; i++)
|
for (i=0; i<N; i++)
|
||||||
{
|
{
|
||||||
Getscriptaddress(coinaddr,CScript() << ParseHex(HexStr(pubkeys[i])) << OP_CHECKSIG);
|
Getscriptaddress(coinaddr,CScript() << ParseHex(HexStr(pubkeys[i])) << OP_CHECKSIG);
|
||||||
if ( CCaddress_balance(coinaddr) == 0 )
|
if ( CCaddress_balance(coinaddr,0) == 0 )
|
||||||
{
|
{
|
||||||
CCerror = strprintf("M.%d N.%d but pubkeys[%d] has no balance",M,N,i);
|
CCerror = strprintf("M.%d N.%d but pubkeys[%d] has no balance",M,N,i);
|
||||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||||
@@ -663,7 +663,7 @@ std::string ImportGatewayWithdraw(uint64_t txfee,uint256 bindtxid,std::string re
|
|||||||
return("");
|
return("");
|
||||||
}
|
}
|
||||||
_GetCCaddress(coinaddr,EVAL_IMPORTGATEWAY,importgatewaypk);
|
_GetCCaddress(coinaddr,EVAL_IMPORTGATEWAY,importgatewaypk);
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
@@ -992,7 +992,7 @@ UniValue ImportGatewayPendingDeposits(uint256 bindtxid,std::string refcoin)
|
|||||||
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
LOGSTREAM("importgateway",CCLOG_INFO, stream << CCerror << std::endl);
|
||||||
return("");
|
return("");
|
||||||
}
|
}
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
@@ -1054,7 +1054,7 @@ UniValue ImportGatewayPendingWithdraws(uint256 bindtxid,std::string refcoin)
|
|||||||
queueflag = 1;
|
queueflag = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
@@ -1142,7 +1142,7 @@ UniValue ImportGatewayProcessedWithdraws(uint256 bindtxid,std::string refcoin)
|
|||||||
queueflag = 1;
|
queueflag = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
@@ -1181,7 +1181,7 @@ UniValue ImportGatewayList()
|
|||||||
struct CCcontract_info *cp,C; uint256 txid,hashBlock,oracletxid; CTransaction vintx; std::string coin;
|
struct CCcontract_info *cp,C; uint256 txid,hashBlock,oracletxid; CTransaction vintx; std::string coin;
|
||||||
char str[65],burnaddr[64]; uint8_t M,N,taddr,prefix,prefix2,wiftype; std::vector<CPubKey> pubkeys;
|
char str[65],burnaddr[64]; uint8_t M,N,taddr,prefix,prefix2,wiftype; std::vector<CPubKey> pubkeys;
|
||||||
cp = CCinit(&C,EVAL_IMPORTGATEWAY);
|
cp = CCinit(&C,EVAL_IMPORTGATEWAY);
|
||||||
SetCCtxids(addressIndex,cp->unspendableCCaddr);
|
SetCCtxids(addressIndex,cp->unspendableCCaddr,true);
|
||||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ int64_t AddLottoInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubK
|
|||||||
char coinaddr[64]; int64_t nValue,price,totalinputs = 0; uint256 txid,hashBlock; std::vector<uint8_t> origpubkey; CTransaction vintx; int32_t n = 0;
|
char coinaddr[64]; int64_t nValue,price,totalinputs = 0; uint256 txid,hashBlock; std::vector<uint8_t> origpubkey; CTransaction vintx; int32_t n = 0;
|
||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||||
GetCCaddress(cp,coinaddr,pk);
|
GetCCaddress(cp,coinaddr,pk);
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
@@ -209,7 +209,7 @@ int64_t LottoPlanFunds(uint64_t refsbits,struct CCcontract_info *cp,CPubKey pk,u
|
|||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||||
lockedfunds = 0;
|
lockedfunds = 0;
|
||||||
GetCCaddress(cp,coinaddr,pk);
|
GetCCaddress(cp,coinaddr,pk);
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
@@ -266,7 +266,7 @@ UniValue LottoList()
|
|||||||
{
|
{
|
||||||
UniValue result(UniValue::VARR); std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex; struct CCcontract_info *cp,C; uint256 txid,hashBlock,hentropy; CTransaction vintx; uint64_t sbits; int32_t ticketsize,odds,firstheight,period; char str[65];
|
UniValue result(UniValue::VARR); std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex; struct CCcontract_info *cp,C; uint256 txid,hashBlock,hentropy; CTransaction vintx; uint64_t sbits; int32_t ticketsize,odds,firstheight,period; char str[65];
|
||||||
cp = CCinit(&C,EVAL_LOTTO);
|
cp = CCinit(&C,EVAL_LOTTO);
|
||||||
SetCCtxids(addressIndex,cp->normaladdr);
|
SetCCtxids(addressIndex,cp->normaladdr,true);
|
||||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
|
|||||||
@@ -352,7 +352,7 @@ int64_t AddMarmaraCoinbases(struct CCcontract_info *cp,CMutableTransaction &mtx,
|
|||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||||
Marmarapk = GetUnspendable(cp,0);
|
Marmarapk = GetUnspendable(cp,0);
|
||||||
GetCCaddress1of2(cp,coinaddr,Marmarapk,poolpk);
|
GetCCaddress1of2(cp,coinaddr,Marmarapk,poolpk);
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
unlocks = MarmaraUnlockht(firstheight);
|
unlocks = MarmaraUnlockht(firstheight);
|
||||||
//fprintf(stderr,"check coinaddr.(%s)\n",coinaddr);
|
//fprintf(stderr,"check coinaddr.(%s)\n",coinaddr);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
@@ -387,7 +387,7 @@ int64_t AddMarmarainputs(CMutableTransaction &mtx,std::vector<CPubKey> &pubkeys,
|
|||||||
{
|
{
|
||||||
uint64_t threshold,nValue,totalinputs = 0; uint256 txid,hashBlock; CTransaction tx; int32_t numvouts,ht,unlockht,vout,i,n = 0; uint8_t funcid; CPubKey pk; std::vector<int64_t> vals;
|
uint64_t threshold,nValue,totalinputs = 0; uint256 txid,hashBlock; CTransaction tx; int32_t numvouts,ht,unlockht,vout,i,n = 0; uint8_t funcid; CPubKey pk; std::vector<int64_t> vals;
|
||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
if ( maxinputs > CC_MAXVINS )
|
if ( maxinputs > CC_MAXVINS )
|
||||||
maxinputs = CC_MAXVINS;
|
maxinputs = CC_MAXVINS;
|
||||||
if ( maxinputs > 0 )
|
if ( maxinputs > 0 )
|
||||||
@@ -441,7 +441,7 @@ UniValue MarmaraLock(uint64_t txfee,int64_t amount,int32_t height)
|
|||||||
mypk = pubkey2pk(Mypubkey());
|
mypk = pubkey2pk(Mypubkey());
|
||||||
Marmarapk = GetUnspendable(cp,0);
|
Marmarapk = GetUnspendable(cp,0);
|
||||||
Getscriptaddress(coinaddr,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG);
|
Getscriptaddress(coinaddr,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG);
|
||||||
if ( (val= CCaddress_balance(coinaddr)) < amount )
|
if ( (val= CCaddress_balance(coinaddr,0)) < amount )
|
||||||
val -= txfee;
|
val -= txfee;
|
||||||
else val = amount;
|
else val = amount;
|
||||||
if ( val > txfee )
|
if ( val > txfee )
|
||||||
@@ -457,7 +457,7 @@ UniValue MarmaraLock(uint64_t txfee,int64_t amount,int32_t height)
|
|||||||
remains = (amount + txfee) - inputsum;
|
remains = (amount + txfee) - inputsum;
|
||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||||
GetCCaddress1of2(cp,coinaddr,Marmarapk,mypk);
|
GetCCaddress1of2(cp,coinaddr,Marmarapk,mypk);
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
threshold = remains / (MARMARA_VINS+1);
|
threshold = remains / (MARMARA_VINS+1);
|
||||||
uint8_t mypriv[32];
|
uint8_t mypriv[32];
|
||||||
Myprivkey(mypriv);
|
Myprivkey(mypriv);
|
||||||
@@ -666,7 +666,7 @@ int32_t MarmaraGetCreditloops(int64_t &totalamount,std::vector<uint256> &issuanc
|
|||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||||
Marmarapk = GetUnspendable(cp,0);
|
Marmarapk = GetUnspendable(cp,0);
|
||||||
GetCCaddress(cp,coinaddr,Marmarapk);
|
GetCCaddress(cp,coinaddr,Marmarapk);
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
// do all txid, conditional on spent/unspent
|
// do all txid, conditional on spent/unspent
|
||||||
//fprintf(stderr,"check coinaddr.(%s)\n",coinaddr);
|
//fprintf(stderr,"check coinaddr.(%s)\n",coinaddr);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
@@ -1059,16 +1059,16 @@ UniValue MarmaraInfo(CPubKey refpk,int32_t firstheight,int32_t lastheight,int64_
|
|||||||
result.push_back(Pair("result","success"));
|
result.push_back(Pair("result","success"));
|
||||||
Getscriptaddress(coinaddr,CScript() << ParseHex(HexStr(Mypubkey())) << OP_CHECKSIG);
|
Getscriptaddress(coinaddr,CScript() << ParseHex(HexStr(Mypubkey())) << OP_CHECKSIG);
|
||||||
result.push_back(Pair("myaddress",coinaddr));
|
result.push_back(Pair("myaddress",coinaddr));
|
||||||
result.push_back(Pair("normal",ValueFromAmount(CCaddress_balance(coinaddr))));
|
result.push_back(Pair("normal",ValueFromAmount(CCaddress_balance(coinaddr,0))));
|
||||||
|
|
||||||
GetCCaddress1of2(cp,coinaddr,Marmarapk,Mypubkey());
|
GetCCaddress1of2(cp,coinaddr,Marmarapk,Mypubkey());
|
||||||
result.push_back(Pair("myCCactivated",coinaddr));
|
result.push_back(Pair("myCCactivated",coinaddr));
|
||||||
result.push_back(Pair("activated",ValueFromAmount(CCaddress_balance(coinaddr))));
|
result.push_back(Pair("activated",ValueFromAmount(CCaddress_balance(coinaddr,1))));
|
||||||
result.push_back(Pair("activated16",ValueFromAmount(AddMarmarainputs(mtx,pubkeys,coinaddr,0,MARMARA_VINS))));
|
result.push_back(Pair("activated16",ValueFromAmount(AddMarmarainputs(mtx,pubkeys,coinaddr,0,MARMARA_VINS))));
|
||||||
|
|
||||||
GetCCaddress(cp,coinaddr,Mypubkey());
|
GetCCaddress(cp,coinaddr,Mypubkey());
|
||||||
result.push_back(Pair("myCCaddress",coinaddr));
|
result.push_back(Pair("myCCaddress",coinaddr));
|
||||||
result.push_back(Pair("CCutxos",ValueFromAmount(CCaddress_balance(coinaddr))));
|
result.push_back(Pair("CCutxos",ValueFromAmount(CCaddress_balance(coinaddr,1))));
|
||||||
|
|
||||||
if ( refpk.size() == 33 )
|
if ( refpk.size() == 33 )
|
||||||
result.push_back(Pair("issuer",HexStr(refpk)));
|
result.push_back(Pair("issuer",HexStr(refpk)));
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ int64_t OracleCurrentDatafee(uint256 reforacletxid,char *markeraddr,CPubKey publ
|
|||||||
{
|
{
|
||||||
uint256 txid,oracletxid,hashBlock; int64_t datafee=0,dfee; int32_t dheight=0,vout,height,numvouts; CTransaction tx; CPubKey pk;
|
uint256 txid,oracletxid,hashBlock; int64_t datafee=0,dfee; int32_t dheight=0,vout,height,numvouts; CTransaction tx; CPubKey pk;
|
||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||||
SetCCunspents(unspentOutputs,markeraddr);
|
SetCCunspents(unspentOutputs,markeraddr,true);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
@@ -260,7 +260,7 @@ uint256 OracleBatonUtxo(uint64_t txfee,struct CCcontract_info *cp,uint256 refora
|
|||||||
{
|
{
|
||||||
uint256 txid,oracletxid,hashBlock,btxid,batontxid = zeroid; int64_t dfee; int32_t dheight=0,vout,height,numvouts; CTransaction tx; CPubKey pk; uint8_t *ptr; std::vector<uint8_t> vopret,data;
|
uint256 txid,oracletxid,hashBlock,btxid,batontxid = zeroid; int64_t dfee; int32_t dheight=0,vout,height,numvouts; CTransaction tx; CPubKey pk; uint8_t *ptr; std::vector<uint8_t> vopret,data;
|
||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||||
SetCCunspents(unspentOutputs,batonaddr);
|
SetCCunspents(unspentOutputs,batonaddr,true);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
@@ -306,7 +306,7 @@ uint256 OraclesBatontxid(uint256 reforacletxid,CPubKey refpk)
|
|||||||
batontxid = zeroid;
|
batontxid = zeroid;
|
||||||
cp = CCinit(&C,EVAL_ORACLES);
|
cp = CCinit(&C,EVAL_ORACLES);
|
||||||
CCtxidaddr(markeraddr,reforacletxid);
|
CCtxidaddr(markeraddr,reforacletxid);
|
||||||
SetCCunspents(unspentOutputs,markeraddr);
|
SetCCunspents(unspentOutputs,markeraddr,true);
|
||||||
//char str[67]; fprintf(stderr,"markeraddr.(%s) %s\n",markeraddr,pubkey33_str(str,(uint8_t *)&refpk));
|
//char str[67]; fprintf(stderr,"markeraddr.(%s) %s\n",markeraddr,pubkey33_str(str,(uint8_t *)&refpk));
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
@@ -525,14 +525,14 @@ int32_t oracleprice_add(std::vector<struct oracleprice_info> &publishers,CPubKey
|
|||||||
} else return(0);
|
} else return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int64_t OraclePrice(int32_t height,uint256 reforacletxid,char *markeraddr,char *format)
|
/*int64_t OraclePrice(int32_t height,uint256 reforacletxid,char *markeraddr,char *format)
|
||||||
{
|
{
|
||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||||
CTransaction regtx; uint256 hash,txid,oracletxid,batontxid; CPubKey pk; int32_t i,ht,maxheight=0; int64_t datafee,price; char batonaddr[64]; std::vector <uint8_t> data; struct CCcontract_info *cp,C; std::vector <struct oracleprice_info> publishers; std::vector <int64_t> prices;
|
CTransaction regtx; uint256 hash,txid,oracletxid,batontxid; CPubKey pk; int32_t i,ht,maxheight=0; int64_t datafee,price; char batonaddr[64]; std::vector <uint8_t> data; struct CCcontract_info *cp,C; std::vector <struct oracleprice_info> publishers; std::vector <int64_t> prices;
|
||||||
if ( format[0] != 'L' )
|
if ( format[0] != 'L' )
|
||||||
return(0);
|
return(0);
|
||||||
cp = CCinit(&C,EVAL_ORACLES);
|
cp = CCinit(&C,EVAL_ORACLES);
|
||||||
SetCCunspents(unspentOutputs,markeraddr);
|
SetCCunspents(unspentOutputs,markeraddr,true);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
@@ -562,7 +562,7 @@ int64_t OraclePrice(int32_t height,uint256 reforacletxid,char *markeraddr,char *
|
|||||||
return(OracleCorrelatedPrice(height,prices));
|
return(OracleCorrelatedPrice(height,prices));
|
||||||
}
|
}
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
int64_t IsOraclesvout(struct CCcontract_info *cp,const CTransaction& tx,int32_t v)
|
int64_t IsOraclesvout(struct CCcontract_info *cp,const CTransaction& tx,int32_t v)
|
||||||
{
|
{
|
||||||
@@ -708,7 +708,7 @@ int64_t AddOracleInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,uint
|
|||||||
char coinaddr[64],funcid; int64_t nValue,price,totalinputs = 0; uint256 tmporacletxid,tmpbatontxid,txid,hashBlock; std::vector<uint8_t> origpubkey,data; CTransaction vintx; int32_t numvouts,vout,n = 0;
|
char coinaddr[64],funcid; int64_t nValue,price,totalinputs = 0; uint256 tmporacletxid,tmpbatontxid,txid,hashBlock; std::vector<uint8_t> origpubkey,data; CTransaction vintx; int32_t numvouts,vout,n = 0;
|
||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs; CPubKey tmppk; int64_t tmpnum;
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs; CPubKey tmppk; int64_t tmpnum;
|
||||||
GetCCaddress(cp,coinaddr,pk);
|
GetCCaddress(cp,coinaddr,pk);
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
//fprintf(stderr,"addoracleinputs from (%s)\n",coinaddr);
|
//fprintf(stderr,"addoracleinputs from (%s)\n",coinaddr);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
@@ -746,7 +746,7 @@ int64_t LifetimeOraclesFunds(struct CCcontract_info *cp,uint256 oracletxid,CPubK
|
|||||||
char coinaddr[64]; CPubKey pk; int64_t total=0,num; uint256 txid,hashBlock,subtxid; CTransaction subtx;
|
char coinaddr[64]; CPubKey pk; int64_t total=0,num; uint256 txid,hashBlock,subtxid; CTransaction subtx;
|
||||||
std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex;
|
std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex;
|
||||||
GetCCaddress(cp,coinaddr,publisher);
|
GetCCaddress(cp,coinaddr,publisher);
|
||||||
SetCCtxids(addressIndex,coinaddr);
|
SetCCtxids(addressIndex,coinaddr,true);
|
||||||
//fprintf(stderr,"scan lifetime of %s\n",coinaddr);
|
//fprintf(stderr,"scan lifetime of %s\n",coinaddr);
|
||||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
||||||
{
|
{
|
||||||
@@ -992,7 +992,7 @@ UniValue OracleInfo(uint256 origtxid)
|
|||||||
result.push_back(Pair("description",description));
|
result.push_back(Pair("description",description));
|
||||||
result.push_back(Pair("format",format));
|
result.push_back(Pair("format",format));
|
||||||
result.push_back(Pair("marker",markeraddr));
|
result.push_back(Pair("marker",markeraddr));
|
||||||
SetCCunspents(unspentOutputs,markeraddr);
|
SetCCunspents(unspentOutputs,markeraddr,true);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
@@ -1028,7 +1028,7 @@ UniValue OraclesList()
|
|||||||
{
|
{
|
||||||
UniValue result(UniValue::VARR); std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex; struct CCcontract_info *cp,C; uint256 txid,hashBlock; CTransaction createtx; std::string name,description,format; char str[65];
|
UniValue result(UniValue::VARR); std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex; struct CCcontract_info *cp,C; uint256 txid,hashBlock; CTransaction createtx; std::string name,description,format; char str[65];
|
||||||
cp = CCinit(&C,EVAL_ORACLES);
|
cp = CCinit(&C,EVAL_ORACLES);
|
||||||
SetCCtxids(addressIndex,cp->normaladdr);
|
SetCCtxids(addressIndex,cp->normaladdr,true);
|
||||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ int64_t AddPaymentsInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CP
|
|||||||
if ( iter == 0 )
|
if ( iter == 0 )
|
||||||
GetCCaddress(cp,coinaddr,Paymentspk);
|
GetCCaddress(cp,coinaddr,Paymentspk);
|
||||||
else GetCCaddress1of2(cp,coinaddr,Paymentspk,txidpk);
|
else GetCCaddress1of2(cp,coinaddr,Paymentspk,txidpk);
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
@@ -864,10 +864,10 @@ UniValue PaymentsInfo(struct CCcontract_info *cp,char *jsonstr)
|
|||||||
result.push_back(Pair("txidoprets",a));
|
result.push_back(Pair("txidoprets",a));
|
||||||
txidpk = CCtxidaddr(txidaddr,createtxid);
|
txidpk = CCtxidaddr(txidaddr,createtxid);
|
||||||
GetCCaddress1of2(cp,fundsaddr,Paymentspk,txidpk);
|
GetCCaddress1of2(cp,fundsaddr,Paymentspk,txidpk);
|
||||||
funds = CCaddress_balance(fundsaddr);
|
funds = CCaddress_balance(fundsaddr,1);
|
||||||
result.push_back(Pair(fundsaddr,ValueFromAmount(funds)));
|
result.push_back(Pair(fundsaddr,ValueFromAmount(funds)));
|
||||||
GetCCaddress(cp,fundsopretaddr,Paymentspk);
|
GetCCaddress(cp,fundsopretaddr,Paymentspk);
|
||||||
fundsopret = CCaddress_balance(fundsopretaddr);
|
fundsopret = CCaddress_balance(fundsopretaddr,1);
|
||||||
result.push_back(Pair(fundsopretaddr,ValueFromAmount(fundsopret)));
|
result.push_back(Pair(fundsopretaddr,ValueFromAmount(fundsopret)));
|
||||||
result.push_back(Pair("totalfunds",ValueFromAmount(funds+fundsopret)));
|
result.push_back(Pair("totalfunds",ValueFromAmount(funds+fundsopret)));
|
||||||
result.push_back(Pair("result","success"));
|
result.push_back(Pair("result","success"));
|
||||||
@@ -896,7 +896,7 @@ UniValue PaymentsList(struct CCcontract_info *cp,char *jsonstr)
|
|||||||
UniValue result(UniValue::VOBJ),a(UniValue::VARR); char markeraddr[64],str[65]; CPubKey Paymentspk; CTransaction tx; int32_t lockedblocks,minrelease; std::vector<uint256> txidoprets; int64_t totalallocations;
|
UniValue result(UniValue::VOBJ),a(UniValue::VARR); char markeraddr[64],str[65]; CPubKey Paymentspk; CTransaction tx; int32_t lockedblocks,minrelease; std::vector<uint256> txidoprets; int64_t totalallocations;
|
||||||
Paymentspk = GetUnspendable(cp,0);
|
Paymentspk = GetUnspendable(cp,0);
|
||||||
GetCCaddress1of2(cp,markeraddr,Paymentspk,Paymentspk);
|
GetCCaddress1of2(cp,markeraddr,Paymentspk,Paymentspk);
|
||||||
SetCCtxids(addressIndex,markeraddr);
|
SetCCtxids(addressIndex,markeraddr,true);
|
||||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ int64_t AddPegsInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,CPubKe
|
|||||||
char coinaddr[64]; int64_t nValue,price,totalinputs = 0; uint256 txid,hashBlock; std::vector<uint8_t> origpubkey; CTransaction vintx; int32_t vout,n = 0;
|
char coinaddr[64]; int64_t nValue,price,totalinputs = 0; uint256 txid,hashBlock; std::vector<uint8_t> origpubkey; CTransaction vintx; int32_t vout,n = 0;
|
||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||||
GetCCaddress(cp,coinaddr,pk);
|
GetCCaddress(cp,coinaddr,pk);
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ int64_t AddPricesInputs(struct CCcontract_info *cp,CMutableTransaction &mtx,char
|
|||||||
{
|
{
|
||||||
int64_t nValue,price,totalinputs = 0; uint256 txid,hashBlock; std::vector<uint8_t> origpubkey; CTransaction vintx; int32_t vout,n = 0;
|
int64_t nValue,price,totalinputs = 0; uint256 txid,hashBlock; std::vector<uint8_t> origpubkey; CTransaction vintx; int32_t vout,n = 0;
|
||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||||
SetCCunspents(unspentOutputs,destaddr);
|
SetCCunspents(unspentOutputs,destaddr,true);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
@@ -711,7 +711,7 @@ UniValue PricesList()
|
|||||||
UniValue result(UniValue::VARR); std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex; struct CCcontract_info *cp,C; int64_t amount,firstprice; int32_t height; int16_t leverage; uint256 txid,hashBlock,tokenid; CPubKey pk,pricespk; std::vector<uint16_t> vec; CTransaction vintx; char str[65];
|
UniValue result(UniValue::VARR); std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex; struct CCcontract_info *cp,C; int64_t amount,firstprice; int32_t height; int16_t leverage; uint256 txid,hashBlock,tokenid; CPubKey pk,pricespk; std::vector<uint16_t> vec; CTransaction vintx; char str[65];
|
||||||
cp = CCinit(&C,EVAL_PRICES);
|
cp = CCinit(&C,EVAL_PRICES);
|
||||||
pricespk = GetUnspendable(cp,0);
|
pricespk = GetUnspendable(cp,0);
|
||||||
SetCCtxids(addressIndex,cp->normaladdr);
|
SetCCtxids(addressIndex,cp->normaladdr,false);
|
||||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
|
|||||||
@@ -338,7 +338,7 @@ int64_t AddRewardsInputs(CScript &scriptPubKey,uint64_t maxseconds,struct CCcont
|
|||||||
char coinaddr[64],str[65]; uint64_t threshold,sbits,nValue,totalinputs = 0; uint256 txid,hashBlock,fundingtxid; CTransaction tx; int32_t numblocks,j,vout,n = 0; uint8_t funcid;
|
char coinaddr[64],str[65]; uint64_t threshold,sbits,nValue,totalinputs = 0; uint256 txid,hashBlock,fundingtxid; CTransaction tx; int32_t numblocks,j,vout,n = 0; uint8_t funcid;
|
||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||||
GetCCaddress(cp,coinaddr,pk);
|
GetCCaddress(cp,coinaddr,pk);
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
if ( maxinputs > CC_MAXVINS )
|
if ( maxinputs > CC_MAXVINS )
|
||||||
maxinputs = CC_MAXVINS;
|
maxinputs = CC_MAXVINS;
|
||||||
if ( maxinputs > 0 )
|
if ( maxinputs > 0 )
|
||||||
@@ -403,7 +403,7 @@ int64_t RewardsPlanFunds(uint64_t &lockedfunds,uint64_t refsbits,struct CCcontra
|
|||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||||
lockedfunds = 0;
|
lockedfunds = 0;
|
||||||
GetCCaddress(cp,coinaddr,pk);
|
GetCCaddress(cp,coinaddr,pk);
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
@@ -433,7 +433,7 @@ bool RewardsPlanExists(struct CCcontract_info *cp,uint64_t refsbits,CPubKey rewa
|
|||||||
char CCaddr[64]; uint64_t sbits; uint256 txid,hashBlock; CTransaction tx;
|
char CCaddr[64]; uint64_t sbits; uint256 txid,hashBlock; CTransaction tx;
|
||||||
std::vector<std::pair<CAddressIndexKey, CAmount> > txids;
|
std::vector<std::pair<CAddressIndexKey, CAmount> > txids;
|
||||||
GetCCaddress(cp,CCaddr,rewardspk);
|
GetCCaddress(cp,CCaddr,rewardspk);
|
||||||
SetCCtxids(txids,CCaddr);
|
SetCCtxids(txids,CCaddr,true);
|
||||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=txids.begin(); it!=txids.end(); it++)
|
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=txids.begin(); it!=txids.end(); it++)
|
||||||
{
|
{
|
||||||
//int height = it->first.blockHeight;
|
//int height = it->first.blockHeight;
|
||||||
@@ -493,7 +493,7 @@ UniValue RewardsList()
|
|||||||
{
|
{
|
||||||
UniValue result(UniValue::VARR); std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex; struct CCcontract_info *cp,C; uint256 txid,hashBlock; CTransaction vintx; uint64_t sbits,APR,minseconds,maxseconds,mindeposit; char str[65];
|
UniValue result(UniValue::VARR); std::vector<std::pair<CAddressIndexKey, CAmount> > addressIndex; struct CCcontract_info *cp,C; uint256 txid,hashBlock; CTransaction vintx; uint64_t sbits,APR,minseconds,maxseconds,mindeposit; char str[65];
|
||||||
cp = CCinit(&C,EVAL_REWARDS);
|
cp = CCinit(&C,EVAL_REWARDS);
|
||||||
SetCCtxids(addressIndex,cp->normaladdr);
|
SetCCtxids(addressIndex,cp->normaladdr,false);
|
||||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
@@ -650,7 +650,7 @@ std::string RewardsUnlock(uint64_t txfee,char *planstr,uint256 fundingtxid,uint2
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
GetCCaddress(cp,coinaddr,rewardspk);
|
GetCCaddress(cp,coinaddr,rewardspk);
|
||||||
if ( (amount= CCutxovalue(coinaddr,locktxid,0)) == 0 )
|
if ( (amount= CCutxovalue(coinaddr,locktxid,0,1)) == 0 )
|
||||||
{
|
{
|
||||||
fprintf(stderr,"%s locktxid/v0 is spent\n",coinaddr);
|
fprintf(stderr,"%s locktxid/v0 is spent\n",coinaddr);
|
||||||
CCerror = "locktxid/v0 is spent";
|
CCerror = "locktxid/v0 is spent";
|
||||||
|
|||||||
@@ -806,7 +806,7 @@ UniValue rogue_newgame(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
|||||||
roguepk = GetUnspendable(cp,0);
|
roguepk = GetUnspendable(cp,0);
|
||||||
rogue_univalue(result,"newgame",maxplayers,buyin);
|
rogue_univalue(result,"newgame",maxplayers,buyin);
|
||||||
required = (3*txfee + maxplayers*(ROGUE_REGISTRATIONSIZE+txfee));
|
required = (3*txfee + maxplayers*(ROGUE_REGISTRATIONSIZE+txfee));
|
||||||
if ( (inputsum= AddCClibInputs(cp,mtx,roguepk,required,16,cp->unspendableCCaddr)) >= required )
|
if ( (inputsum= AddCClibInputs(cp,mtx,roguepk,required,16,cp->unspendableCCaddr,1)) >= required )
|
||||||
{
|
{
|
||||||
mtx.vout.push_back(MakeCC1vout(cp->evalcode,txfee,roguepk)); // for highlander TCBOO creation
|
mtx.vout.push_back(MakeCC1vout(cp->evalcode,txfee,roguepk)); // for highlander TCBOO creation
|
||||||
for (i=0; i<maxplayers; i++)
|
for (i=0; i<maxplayers; i++)
|
||||||
@@ -1301,7 +1301,7 @@ UniValue rogue_finishgame(uint64_t txfee,struct CCcontract_info *cp,cJSON *param
|
|||||||
}
|
}
|
||||||
if ( cashout > 0 )
|
if ( cashout > 0 )
|
||||||
{
|
{
|
||||||
if ( (inputsum= AddCClibInputs(cp,mtx,roguepk,cashout,60,cp->unspendableCCaddr)) > cashout )
|
if ( (inputsum= AddCClibInputs(cp,mtx,roguepk,cashout,60,cp->unspendableCCaddr,1)) > cashout )
|
||||||
CCchange = (inputsum - cashout);
|
CCchange = (inputsum - cashout);
|
||||||
else fprintf(stderr,"couldnt find enough utxos\n");
|
else fprintf(stderr,"couldnt find enough utxos\n");
|
||||||
}
|
}
|
||||||
@@ -1397,7 +1397,7 @@ UniValue rogue_pending(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
|||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||||
roguepk = GetUnspendable(cp,0);
|
roguepk = GetUnspendable(cp,0);
|
||||||
GetCCaddress(cp,coinaddr,roguepk);
|
GetCCaddress(cp,coinaddr,roguepk);
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
nextheight = komodo_nextheight();
|
nextheight = komodo_nextheight();
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
@@ -1427,7 +1427,7 @@ UniValue rogue_players(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
|||||||
roguepk = GetUnspendable(cp,0);
|
roguepk = GetUnspendable(cp,0);
|
||||||
mypk = pubkey2pk(Mypubkey());
|
mypk = pubkey2pk(Mypubkey());
|
||||||
GetTokensCCaddress(cp,coinaddr,mypk);
|
GetTokensCCaddress(cp,coinaddr,mypk);
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
rogue_univalue(result,"players",-1,-1);
|
rogue_univalue(result,"players",-1,-1);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
@@ -1456,7 +1456,7 @@ UniValue rogue_games(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
|||||||
mypk = pubkey2pk(Mypubkey());
|
mypk = pubkey2pk(Mypubkey());
|
||||||
GetCCaddress1of2(cp,coinaddr,roguepk,mypk);
|
GetCCaddress1of2(cp,coinaddr,roguepk,mypk);
|
||||||
//SetCCunspents(unspentOutputs,coinaddr);
|
//SetCCunspents(unspentOutputs,coinaddr);
|
||||||
SetCCtxids(addressIndex,coinaddr);
|
SetCCtxids(addressIndex,coinaddr,true);
|
||||||
rogue_univalue(result,"games",-1,-1);
|
rogue_univalue(result,"games",-1,-1);
|
||||||
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
for (std::vector<std::pair<CAddressIndexKey, CAmount> >::const_iterator it=addressIndex.begin(); it!=addressIndex.end(); it++)
|
||||||
//for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
//for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
|
|||||||
@@ -2679,7 +2679,7 @@ UniValue sudoku_generate(uint64_t txfee,struct CCcontract_info *cp,cJSON *params
|
|||||||
sudokupk = GetUnspendable(cp,0);
|
sudokupk = GetUnspendable(cp,0);
|
||||||
result.push_back(Pair("srand",(int)srandi));
|
result.push_back(Pair("srand",(int)srandi));
|
||||||
result.push_back(Pair("amount",ValueFromAmount(amount)));
|
result.push_back(Pair("amount",ValueFromAmount(amount)));
|
||||||
if ( (inputsum= AddCClibInputs(cp,mtx,sudokupk,amount+2*txfee,16,cp->unspendableCCaddr)) >= amount+2*txfee )
|
if ( (inputsum= AddCClibInputs(cp,mtx,sudokupk,amount+2*txfee,16,cp->unspendableCCaddr,1)) >= amount+2*txfee )
|
||||||
{
|
{
|
||||||
//printf("inputsum %.8f\n",(double)inputsum/COIN);
|
//printf("inputsum %.8f\n",(double)inputsum/COIN);
|
||||||
mtx.vout.push_back(MakeCC1vout(cp->evalcode,txfee,sudokupk));
|
mtx.vout.push_back(MakeCC1vout(cp->evalcode,txfee,sudokupk));
|
||||||
@@ -2772,7 +2772,7 @@ UniValue sudoku_pending(uint64_t txfee,struct CCcontract_info *cp,cJSON *params)
|
|||||||
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
|
||||||
sudokupk = GetUnspendable(cp,0);
|
sudokupk = GetUnspendable(cp,0);
|
||||||
GetCCaddress(cp,coinaddr,sudokupk);
|
GetCCaddress(cp,coinaddr,sudokupk);
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
@@ -2844,7 +2844,7 @@ UniValue sudoku_solution(uint64_t txfee,struct CCcontract_info *cp,cJSON *params
|
|||||||
pk = buf2pk(pub33);
|
pk = buf2pk(pub33);
|
||||||
GetCCaddress(cp,CCaddr,pk);
|
GetCCaddress(cp,CCaddr,pk);
|
||||||
result.push_back(Pair("sudokuaddr",CCaddr));
|
result.push_back(Pair("sudokuaddr",CCaddr));
|
||||||
balance = CCaddress_balance(CCaddr);
|
balance = CCaddress_balance(CCaddr,1);
|
||||||
result.push_back(Pair("amount",ValueFromAmount(balance)));
|
result.push_back(Pair("amount",ValueFromAmount(balance)));
|
||||||
if ( sudoku_captcha(1,timestamps,komodo_nextheight()) < 0 )
|
if ( sudoku_captcha(1,timestamps,komodo_nextheight()) < 0 )
|
||||||
{
|
{
|
||||||
@@ -2892,7 +2892,7 @@ UniValue sudoku_solution(uint64_t txfee,struct CCcontract_info *cp,cJSON *params
|
|||||||
if ( good != 0 )
|
if ( good != 0 )
|
||||||
{
|
{
|
||||||
mtx.vin.push_back(CTxIn(txid,0,CScript()));
|
mtx.vin.push_back(CTxIn(txid,0,CScript()));
|
||||||
if ( (inputsum= AddCClibInputs(cp,mtx,pk,balance,16,CCaddr)) >= balance )
|
if ( (inputsum= AddCClibInputs(cp,mtx,pk,balance,16,CCaddr,1)) >= balance )
|
||||||
{
|
{
|
||||||
mtx.vout.push_back(CTxOut(balance,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG));
|
mtx.vout.push_back(CTxOut(balance,CScript() << ParseHex(HexStr(mypk)) << OP_CHECKSIG));
|
||||||
CCaddr2set(cp,cp->evalcode,pk,priv32,CCaddr);
|
CCaddr2set(cp,cp->evalcode,pk,priv32,CCaddr);
|
||||||
|
|||||||
@@ -2472,7 +2472,7 @@ int32_t komodo_staked(CMutableTransaction &txNew,uint32_t nBits,uint32_t *blockt
|
|||||||
mypk = pubkey2pk(Mypubkey());
|
mypk = pubkey2pk(Mypubkey());
|
||||||
Marmarapk = GetUnspendable(cp,0);
|
Marmarapk = GetUnspendable(cp,0);
|
||||||
GetCCaddress1of2(cp,coinaddr,Marmarapk,mypk);
|
GetCCaddress1of2(cp,coinaddr,Marmarapk,mypk);
|
||||||
SetCCunspents(unspentOutputs,coinaddr);
|
SetCCunspents(unspentOutputs,coinaddr,true);
|
||||||
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
|
||||||
{
|
{
|
||||||
txid = it->first.txhash;
|
txid = it->first.txhash;
|
||||||
|
|||||||
@@ -1555,6 +1555,7 @@ extern std::vector<uint8_t> Mineropret; // opreturn data set by the data gatheri
|
|||||||
#define KOMODO_LOCALPRICE_CACHESIZE 13
|
#define KOMODO_LOCALPRICE_CACHESIZE 13
|
||||||
#define KOMODO_MAXPRICES 2048
|
#define KOMODO_MAXPRICES 2048
|
||||||
#define PRICES_SMOOTHWIDTH 1
|
#define PRICES_SMOOTHWIDTH 1
|
||||||
|
#define PRICES_MAXDATAPOINTS 8
|
||||||
|
|
||||||
#define issue_curl(cmdstr) bitcoind_RPC(0,(char *)"CBCOINBASE",cmdstr,0,0,0)
|
#define issue_curl(cmdstr) bitcoind_RPC(0,(char *)"CBCOINBASE",cmdstr,0,0,0)
|
||||||
|
|
||||||
@@ -1747,6 +1748,7 @@ CScript komodo_mineropret(int32_t nHeight)
|
|||||||
|
|
||||||
void komodo_queuelocalprice(int32_t dir,int32_t height,uint32_t timestamp,uint256 blockhash,int32_t ind,uint32_t pricebits)
|
void komodo_queuelocalprice(int32_t dir,int32_t height,uint32_t timestamp,uint256 blockhash,int32_t ind,uint32_t pricebits)
|
||||||
{
|
{
|
||||||
|
fprintf(stderr,"ExtremePrice dir.%d ht.%d ind.%d cmpbits.%u\n",dir,height,ind,pricebits);
|
||||||
ExtremePrice.dir = dir;
|
ExtremePrice.dir = dir;
|
||||||
ExtremePrice.height = height;
|
ExtremePrice.height = height;
|
||||||
ExtremePrice.blockhash = blockhash;
|
ExtremePrice.blockhash = blockhash;
|
||||||
@@ -2226,6 +2228,7 @@ void komodo_cbopretupdate(int32_t forceflag)
|
|||||||
memcpy(Mineropret.data(),PriceCache[0],size);
|
memcpy(Mineropret.data(),PriceCache[0],size);
|
||||||
if ( ExtremePrice.dir != 0 && ExtremePrice.ind > 0 && ExtremePrice.ind < size/sizeof(uint32_t) && now < ExtremePrice.timestamp+3600 )
|
if ( ExtremePrice.dir != 0 && ExtremePrice.ind > 0 && ExtremePrice.ind < size/sizeof(uint32_t) && now < ExtremePrice.timestamp+3600 )
|
||||||
{
|
{
|
||||||
|
fprintf(stderr,"cmp dir.%d PriceCache[0][ExtremePrice.ind] %u >= %u ExtremePrice.pricebits\n",ExtremePrice.dir,PriceCache[0][ExtremePrice.ind],ExtremePrice.pricebits);
|
||||||
if ( (ExtremePrice.dir > 0 && PriceCache[0][ExtremePrice.ind] >= ExtremePrice.pricebits) || (ExtremePrice.dir < 0 && PriceCache[0][ExtremePrice.ind] <= ExtremePrice.pricebits) )
|
if ( (ExtremePrice.dir > 0 && PriceCache[0][ExtremePrice.ind] >= ExtremePrice.pricebits) || (ExtremePrice.dir < 0 && PriceCache[0][ExtremePrice.ind] <= ExtremePrice.pricebits) )
|
||||||
{
|
{
|
||||||
fprintf(stderr,"future price is close enough to allow approving previously rejected block ind.%d %u vs %u\n",ExtremePrice.ind,PriceCache[0][ExtremePrice.ind],ExtremePrice.pricebits);
|
fprintf(stderr,"future price is close enough to allow approving previously rejected block ind.%d %u vs %u\n",ExtremePrice.ind,PriceCache[0][ExtremePrice.ind],ExtremePrice.pricebits);
|
||||||
@@ -2609,7 +2612,7 @@ void komodo_pricesinit()
|
|||||||
PRICES[i].fp = fopen(pricefname.string().c_str(), createflag != 0 ? "wb+" : "rb+");
|
PRICES[i].fp = fopen(pricefname.string().c_str(), createflag != 0 ? "wb+" : "rb+");
|
||||||
if ( createflag != 0 )
|
if ( createflag != 0 )
|
||||||
{
|
{
|
||||||
fseek(PRICES[i].fp,(2*PRICES_DAYWINDOW+PRICES_SMOOTHWIDTH) * sizeof(int64_t) * 3,SEEK_SET);
|
fseek(PRICES[i].fp,(2*PRICES_DAYWINDOW+PRICES_SMOOTHWIDTH) * sizeof(int64_t) * PRICES_MAXDATAPOINTS,SEEK_SET);
|
||||||
fputc(0,PRICES[i].fp);
|
fputc(0,PRICES[i].fp);
|
||||||
fflush(PRICES[i].fp);
|
fflush(PRICES[i].fp);
|
||||||
}
|
}
|
||||||
@@ -2631,7 +2634,7 @@ void komodo_pricesupdate(int32_t height,CBlock *pblock)
|
|||||||
{
|
{
|
||||||
numprices = (int32_t)(komodo_cbopretsize(ASSETCHAINS_CBOPRET) / sizeof(uint32_t));
|
numprices = (int32_t)(komodo_cbopretsize(ASSETCHAINS_CBOPRET) / sizeof(uint32_t));
|
||||||
ptr32 = (uint32_t *)calloc(sizeof(uint32_t),numprices * width);
|
ptr32 = (uint32_t *)calloc(sizeof(uint32_t),numprices * width);
|
||||||
ptr64 = (int64_t *)calloc(sizeof(int64_t),PRICES_DAYWINDOW*3);
|
ptr64 = (int64_t *)calloc(sizeof(int64_t),PRICES_DAYWINDOW*PRICES_MAXDATAPOINTS);
|
||||||
tmpbuf = (int64_t *)calloc(sizeof(int64_t),2*PRICES_DAYWINDOW);
|
tmpbuf = (int64_t *)calloc(sizeof(int64_t),2*PRICES_DAYWINDOW);
|
||||||
fprintf(stderr,"prices update: numprices.%d %p %p\n",numprices,ptr32,ptr64);
|
fprintf(stderr,"prices update: numprices.%d %p %p\n",numprices,ptr32,ptr64);
|
||||||
}
|
}
|
||||||
@@ -2658,7 +2661,7 @@ void komodo_pricesupdate(int32_t height,CBlock *pblock)
|
|||||||
rngval = (rngval*11109 + 13849);
|
rngval = (rngval*11109 + 13849);
|
||||||
if ( (correlated= komodo_pricecorrelated(rngval,ind,&ptr32[offset],-numprices,0,PRICES_SMOOTHWIDTH)) > 0 )
|
if ( (correlated= komodo_pricecorrelated(rngval,ind,&ptr32[offset],-numprices,0,PRICES_SMOOTHWIDTH)) > 0 )
|
||||||
{
|
{
|
||||||
fseek(PRICES[ind].fp,height * sizeof(int64_t) * 3,SEEK_SET);
|
fseek(PRICES[ind].fp,height * sizeof(int64_t) * PRICES_MAXDATAPOINTS,SEEK_SET);
|
||||||
buf[0] = rawprices[ind];
|
buf[0] = rawprices[ind];
|
||||||
buf[1] = rawprices[0]; // timestamp
|
buf[1] = rawprices[0]; // timestamp
|
||||||
memcpy(&buf[2],&correlated,sizeof(correlated));
|
memcpy(&buf[2],&correlated,sizeof(correlated));
|
||||||
@@ -2666,20 +2669,15 @@ void komodo_pricesupdate(int32_t height,CBlock *pblock)
|
|||||||
fprintf(stderr,"error fwrite buf for ht.%d ind.%d\n",height,ind);
|
fprintf(stderr,"error fwrite buf for ht.%d ind.%d\n",height,ind);
|
||||||
else if ( height > PRICES_DAYWINDOW*2 )
|
else if ( height > PRICES_DAYWINDOW*2 )
|
||||||
{
|
{
|
||||||
fseek(PRICES[ind].fp,(height-PRICES_DAYWINDOW+1) * 3 * sizeof(int64_t),SEEK_SET);
|
fseek(PRICES[ind].fp,(height-PRICES_DAYWINDOW+1) * PRICES_MAXDATAPOINTS * sizeof(int64_t),SEEK_SET);
|
||||||
if ( fread(ptr64,sizeof(int64_t),PRICES_DAYWINDOW*3-1,PRICES[ind].fp) == PRICES_DAYWINDOW*3-1 )
|
if ( fread(ptr64,sizeof(int64_t),(PRICES_DAYWINDOW-1)*PRICES_MAXDATAPOINTS+2,PRICES[ind].fp) == (PRICES_DAYWINDOW-1)*PRICES_MAXDATAPOINTS+2 )
|
||||||
{
|
{
|
||||||
if ( (smoothed= komodo_priceave(tmpbuf,&ptr64[PRICES_DAYWINDOW*3-2],-3)) > 0 )
|
if ( (smoothed= komodo_priceave(tmpbuf,&ptr64[(PRICES_DAYWINDOW-1)*PRICES_MAXDATAPOINTS+1],-PRICES_MAXDATAPOINTS)) > 0 )
|
||||||
{
|
{
|
||||||
fseek(PRICES[ind].fp,(height * 3 + 2) * sizeof(int64_t),SEEK_SET);
|
fseek(PRICES[ind].fp,(height * PRICES_MAXDATAPOINTS + 2) * sizeof(int64_t),SEEK_SET);
|
||||||
if ( fwrite(&smoothed,1,sizeof(smoothed),PRICES[ind].fp) != sizeof(smoothed) )
|
if ( fwrite(&smoothed,1,sizeof(smoothed),PRICES[ind].fp) != sizeof(smoothed) )
|
||||||
fprintf(stderr,"error fwrite smoothed for ht.%d ind.%d\n",height,ind);
|
fprintf(stderr,"error fwrite smoothed for ht.%d ind.%d\n",height,ind);
|
||||||
else
|
else fflush(PRICES[ind].fp);
|
||||||
{
|
|
||||||
if ( ind == 36 )
|
|
||||||
fprintf(stderr,"(%.8f %.8f) ",(double)ptr64[PRICES_DAYWINDOW*3-2]/COIN,(double)smoothed/COIN);
|
|
||||||
fflush(PRICES[ind].fp);
|
|
||||||
}
|
|
||||||
} else fprintf(stderr,"error price_smoothed ht.%d ind.%d\n",height,ind);
|
} else fprintf(stderr,"error price_smoothed ht.%d ind.%d\n",height,ind);
|
||||||
} else fprintf(stderr,"error fread ptr64 for ht.%d ind.%d\n",height,ind);
|
} else fprintf(stderr,"error fread ptr64 for ht.%d ind.%d\n",height,ind);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1670,7 +1670,7 @@ void SplitStr(const std::string& strVal, std::vector<std::string> &outVals);
|
|||||||
void komodo_args(char *argv0)
|
void komodo_args(char *argv0)
|
||||||
{
|
{
|
||||||
extern const char *Notaries_elected1[][2];
|
extern const char *Notaries_elected1[][2];
|
||||||
std::string name,addn,hexstr,symbol; char *dirname,fname[512],arg0str[64],magicstr[9]; uint8_t magic[4],extrabuf[8192],disablebits[32],*extraptr=0; FILE *fp; uint64_t val; uint16_t port; int32_t i,nonz=0,baseid,len,n,extralen = 0; uint64_t ccenables[256];
|
std::string name,addn,hexstr,symbol; char *dirname,fname[512],arg0str[64],magicstr[9]; uint8_t magic[4],extrabuf[32756],disablebits[32],*extraptr=0; FILE *fp; uint64_t val; uint16_t port; int32_t i,nonz=0,baseid,len,n,extralen = 0; uint64_t ccenables[256];
|
||||||
IS_KOMODO_NOTARY = GetBoolArg("-notary", false);
|
IS_KOMODO_NOTARY = GetBoolArg("-notary", false);
|
||||||
IS_STAKED_NOTARY = GetArg("-stakednotary", -1);
|
IS_STAKED_NOTARY = GetArg("-stakednotary", -1);
|
||||||
if ( IS_STAKED_NOTARY != -1 && IS_KOMODO_NOTARY == true ) {
|
if ( IS_STAKED_NOTARY != -1 && IS_KOMODO_NOTARY == true ) {
|
||||||
@@ -1811,11 +1811,14 @@ void komodo_args(char *argv0)
|
|||||||
ASSETCHAINS_CODAPORT = GetArg("-ac_coda",0);
|
ASSETCHAINS_CODAPORT = GetArg("-ac_coda",0);
|
||||||
ASSETCHAINS_MARMARA = GetArg("-ac_marmara",0);
|
ASSETCHAINS_MARMARA = GetArg("-ac_marmara",0);
|
||||||
ASSETCHAINS_CBOPRET = GetArg("-ac_cbopret",0);
|
ASSETCHAINS_CBOPRET = GetArg("-ac_cbopret",0);
|
||||||
|
//fprintf(stderr,"ASSETCHAINS_CBOPRET.%llx\n",(long long)ASSETCHAINS_CBOPRET);
|
||||||
if ( ASSETCHAINS_CBOPRET != 0 )
|
if ( ASSETCHAINS_CBOPRET != 0 )
|
||||||
{
|
{
|
||||||
SplitStr(GetArg("-ac_prices",""), ASSETCHAINS_PRICES);
|
SplitStr(GetArg("-ac_prices",""), ASSETCHAINS_PRICES);
|
||||||
for (i=0; i<ASSETCHAINS_PRICES.size(); i++)
|
for (i=0; i<ASSETCHAINS_PRICES.size(); i++)
|
||||||
fprintf(stderr,"%s ",ASSETCHAINS_PRICES[i].c_str());
|
fprintf(stderr,"%s ",ASSETCHAINS_PRICES[i].c_str());
|
||||||
|
if ( ASSETCHAINS_PRICES.size() > 0 )
|
||||||
|
ASSETCHAINS_CBOPRET |= 4;
|
||||||
fprintf(stderr,"%d -ac_prices\n",(int32_t)ASSETCHAINS_PRICES.size());
|
fprintf(stderr,"%d -ac_prices\n",(int32_t)ASSETCHAINS_PRICES.size());
|
||||||
}
|
}
|
||||||
hexstr = GetArg("-ac_mineropret","");
|
hexstr = GetArg("-ac_mineropret","");
|
||||||
|
|||||||
@@ -867,7 +867,7 @@ bool getAddressesFromParams(const UniValue& params, std::vector<std::pair<uint16
|
|||||||
CBitcoinAddress address(params[0].get_str());
|
CBitcoinAddress address(params[0].get_str());
|
||||||
uint160 hashBytes;
|
uint160 hashBytes;
|
||||||
int type = 0;
|
int type = 0;
|
||||||
if (!address.GetIndexKey(hashBytes, type)) {
|
if (!address.GetIndexKey(hashBytes, type, 0)) {
|
||||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid address");
|
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid address");
|
||||||
}
|
}
|
||||||
addresses.push_back(std::make_pair(hashBytes, type));
|
addresses.push_back(std::make_pair(hashBytes, type));
|
||||||
@@ -885,7 +885,7 @@ bool getAddressesFromParams(const UniValue& params, std::vector<std::pair<uint16
|
|||||||
CBitcoinAddress address(it->get_str());
|
CBitcoinAddress address(it->get_str());
|
||||||
uint160 hashBytes;
|
uint160 hashBytes;
|
||||||
int type = 0;
|
int type = 0;
|
||||||
if (!address.GetIndexKey(hashBytes, type)) {
|
if (!address.GetIndexKey(hashBytes, type, 0)) {
|
||||||
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid addresses");
|
throw JSONRPCError(RPC_INVALID_ADDRESS_OR_KEY, "Invalid addresses");
|
||||||
}
|
}
|
||||||
addresses.push_back(std::make_pair(hashBytes, type));
|
addresses.push_back(std::make_pair(hashBytes, type));
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ void CTxMemPool::addAddressIndex(const CTxMemPoolEntry &entry, const CCoinsViewC
|
|||||||
if (vDest.which())
|
if (vDest.which())
|
||||||
{
|
{
|
||||||
uint160 hashBytes;
|
uint160 hashBytes;
|
||||||
if (CBitcoinAddress(vDest).GetIndexKey(hashBytes, keyType))
|
if (CBitcoinAddress(vDest).GetIndexKey(hashBytes, keyType, prevout.scriptPubKey.IsPayToCryptoCondition()))
|
||||||
{
|
{
|
||||||
vSols.push_back(vector<unsigned char>(hashBytes.begin(), hashBytes.end()));
|
vSols.push_back(vector<unsigned char>(hashBytes.begin(), hashBytes.end()));
|
||||||
}
|
}
|
||||||
@@ -192,7 +192,7 @@ void CTxMemPool::addAddressIndex(const CTxMemPoolEntry &entry, const CCoinsViewC
|
|||||||
if (vDest.which())
|
if (vDest.which())
|
||||||
{
|
{
|
||||||
uint160 hashBytes;
|
uint160 hashBytes;
|
||||||
if (CBitcoinAddress(vDest).GetIndexKey(hashBytes, keyType))
|
if (CBitcoinAddress(vDest).GetIndexKey(hashBytes, keyType, out.scriptPubKey.IsPayToCryptoCondition()))
|
||||||
{
|
{
|
||||||
vSols.push_back(vector<unsigned char>(hashBytes.begin(), hashBytes.end()));
|
vSols.push_back(vector<unsigned char>(hashBytes.begin(), hashBytes.end()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5369,11 +5369,11 @@ UniValue CCaddress(struct CCcontract_info *cp,char *name,std::vector<unsigned ch
|
|||||||
sprintf(str,"%sCCAddress",name);
|
sprintf(str,"%sCCAddress",name);
|
||||||
result.push_back(Pair(str,cp->unspendableCCaddr));
|
result.push_back(Pair(str,cp->unspendableCCaddr));
|
||||||
sprintf(str,"%sCCBalance",name);
|
sprintf(str,"%sCCBalance",name);
|
||||||
result.push_back(Pair(str,ValueFromAmount(CCaddress_balance(cp->unspendableCCaddr))));
|
result.push_back(Pair(str,ValueFromAmount(CCaddress_balance(cp->unspendableCCaddr,1))));
|
||||||
sprintf(str,"%sNormalAddress",name);
|
sprintf(str,"%sNormalAddress",name);
|
||||||
result.push_back(Pair(str,cp->normaladdr));
|
result.push_back(Pair(str,cp->normaladdr));
|
||||||
sprintf(str,"%sNormalBalance",name);
|
sprintf(str,"%sNormalBalance",name);
|
||||||
result.push_back(Pair(str,ValueFromAmount(CCaddress_balance(cp->normaladdr))));
|
result.push_back(Pair(str,ValueFromAmount(CCaddress_balance(cp->normaladdr,0))));
|
||||||
if (strcmp(name,"Gateways")==0) result.push_back(Pair("GatewaysPubkey","03ea9c062b9652d8eff34879b504eda0717895d27597aaeb60347d65eed96ccb40"));
|
if (strcmp(name,"Gateways")==0) result.push_back(Pair("GatewaysPubkey","03ea9c062b9652d8eff34879b504eda0717895d27597aaeb60347d65eed96ccb40"));
|
||||||
if ((strcmp(name,"Channels")==0 || strcmp(name,"Heir")==0) && pubkey.size() == 33)
|
if ((strcmp(name,"Channels")==0 || strcmp(name,"Heir")==0) && pubkey.size() == 33)
|
||||||
{
|
{
|
||||||
@@ -5402,7 +5402,7 @@ UniValue CCaddress(struct CCcontract_info *cp,char *name,std::vector<unsigned ch
|
|||||||
sprintf(str,"PubkeyCCaddress(%s)",name);
|
sprintf(str,"PubkeyCCaddress(%s)",name);
|
||||||
result.push_back(Pair(str,destaddr));
|
result.push_back(Pair(str,destaddr));
|
||||||
sprintf(str,"PubkeyCCbalance(%s)",name);
|
sprintf(str,"PubkeyCCbalance(%s)",name);
|
||||||
result.push_back(Pair(str,ValueFromAmount(CCaddress_balance(destaddr))));
|
result.push_back(Pair(str,ValueFromAmount(CCaddress_balance(destaddr,0))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( GetCCaddress(cp,destaddr,pubkey2pk(Mypubkey())) != 0 )
|
if ( GetCCaddress(cp,destaddr,pubkey2pk(Mypubkey())) != 0 )
|
||||||
@@ -5410,12 +5410,12 @@ UniValue CCaddress(struct CCcontract_info *cp,char *name,std::vector<unsigned ch
|
|||||||
sprintf(str,"myCCAddress(%s)",name);
|
sprintf(str,"myCCAddress(%s)",name);
|
||||||
result.push_back(Pair(str,destaddr));
|
result.push_back(Pair(str,destaddr));
|
||||||
sprintf(str,"myCCbalance(%s)",name);
|
sprintf(str,"myCCbalance(%s)",name);
|
||||||
result.push_back(Pair(str,ValueFromAmount(CCaddress_balance(destaddr))));
|
result.push_back(Pair(str,ValueFromAmount(CCaddress_balance(destaddr,1))));
|
||||||
}
|
}
|
||||||
if ( Getscriptaddress(destaddr,(CScript() << Mypubkey() << OP_CHECKSIG)) != 0 )
|
if ( Getscriptaddress(destaddr,(CScript() << Mypubkey() << OP_CHECKSIG)) != 0 )
|
||||||
{
|
{
|
||||||
result.push_back(Pair("myaddress",destaddr));
|
result.push_back(Pair("myaddress",destaddr));
|
||||||
result.push_back(Pair("mybalance",ValueFromAmount(CCaddress_balance(destaddr))));
|
result.push_back(Pair("mybalance",ValueFromAmount(CCaddress_balance(destaddr,0))));
|
||||||
}
|
}
|
||||||
return(result);
|
return(result);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user