Gateways with new TokensCC (#15)

- Adapting Gateways to new Tokens
- Making withdraws serialized until solution for parallel is made
This commit is contained in:
Mihailo Milenkovic
2019-01-28 13:54:21 +01:00
committed by GitHub
parent 59c67afa11
commit 463caf96ec
7 changed files with 700 additions and 504 deletions

View File

@@ -390,9 +390,9 @@ int64_t CCfullsupply(uint256 tokenid)
return(0);
}
int64_t CCtoken_balance(char *coinaddr,uint256 tokenid)
int64_t CCtoken_balance(char *coinaddr,uint256 reftokenid)
{
int64_t price,sum = 0; int32_t numvouts; CTransaction tx; uint256 assetid,assetid2,txid,hashBlock;
int64_t price,sum = 0; int32_t numvouts; CTransaction tx; uint256 tokenid,txid,hashBlock;
std::vector<uint8_t> vopretExtra;
std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > unspentOutputs;
uint8_t evalCode;
@@ -401,11 +401,11 @@ int64_t CCtoken_balance(char *coinaddr,uint256 tokenid)
for (std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> >::const_iterator it=unspentOutputs.begin(); it!=unspentOutputs.end(); it++)
{
txid = it->first.txhash;
if ( GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts= tx.vout.size()) > 0 )
if ( GetTransaction(txid,tx,hashBlock,false) != 0 && (numvouts=tx.vout.size()) > 0 )
{
char str[65]; fprintf(stderr,"check %s %.8f\n",uint256_str(str,txid),(double)it->second.satoshis/COIN);
char str[65];
std::vector<CPubKey> voutTokenPubkeys;
if ( DecodeTokenOpRet(tx.vout[numvouts-1].scriptPubKey, evalCode, assetid, voutTokenPubkeys, vopretExtra) != 0 && assetid == tokenid )
if ( reftokenid==txid || (DecodeTokenOpRet(tx.vout[numvouts-1].scriptPubKey, evalCode, tokenid, voutTokenPubkeys, vopretExtra) != 0 && reftokenid == tokenid))
{
sum += it->second.satoshis;
}