Skip to content

Commit

Permalink
Merge pull request #25 from TokelPlatform/tkltest
Browse files Browse the repository at this point in the history
Tkltest
  • Loading branch information
NutellaLicka authored Oct 23, 2021
2 parents 6d9c833 + dc4c247 commit 0816254
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 39 deletions.
17 changes: 10 additions & 7 deletions src/cc/CCtokens_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -575,16 +575,16 @@ UniValue GetAllTokenBalances(CPubKey pk, bool useMempool)
LOGSTREAM(cctokens_log, CCLOG_DEBUG1, stream << funcname << "()" << " checking tx vout destaddress=" << destaddr << " amount=" << tx.vout[index].nValue << std::endl);

uint8_t funcId = 0;
uint256 tokenIdInOpret;
uint256 tokenIdOut;
CScript opret;
std::string errorStr;

CAmount retAmount = V::CheckTokensvout(cp, NULL, tx, index, opret, tokenIdInOpret, funcId, errorStr);
CAmount retAmount = V::CheckTokensvout(cp, NULL, tx, index, opret, tokenIdOut, funcId, errorStr);

if (retAmount > 0 && !myIsutxo_spentinmempool(ignoretxid, ignorevin, txhash, index))
{
CAmount prevAmount = result[tokenIdInOpret.GetHex()].get_int64();
mapBalances[tokenIdInOpret] += retAmount;
{
CAmount prevAmount = mapBalances[tokenIdOut];
mapBalances[tokenIdOut] = prevAmount + retAmount;
}
}
}; // auto add_token_amount
Expand Down Expand Up @@ -615,8 +615,11 @@ UniValue GetAllTokenBalances(CPubKey pk, bool useMempool)
add_token_amount(it->first.txhash, it->first.index, it->second.satoshis);
}

for(auto const &m : mapBalances)
result.pushKV(m.first.GetHex(), m.second);
for(auto const &m : mapBalances) {
UniValue elem(UniValue::VOBJ);
elem.pushKV(m.first.GetHex(), m.second);
result.push_back(elem);
}

return result;
}
Expand Down
3 changes: 1 addition & 2 deletions src/cc/CCtx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -799,8 +799,7 @@ void SetCCunspentsCCIndex(std::vector<std::pair<CUnspentCCIndexKey, CUnspentCCIn

if (address.GetIndexKey(hashBytes, type, true) == 0)
return;
if (!creationId.IsNull())
searchKeys.push_back(std::make_pair(hashBytes, creationId));
searchKeys.push_back(std::make_pair(hashBytes, creationId));
for (std::vector<std::pair<uint160, uint256> >::iterator it = searchKeys.begin(); it != searchKeys.end(); it++)
{
if (GetUnspentCCIndex((*it).first, (*it).second, unspentOutputs, -1, -1, 0) == 0)
Expand Down
20 changes: 13 additions & 7 deletions src/komodo_nSPV.h
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ uint256 NSPV_opretextract(int32_t *heightp,uint256 *blockhashp,char *symbol,std:

int32_t NSPV_notarizationextract(int32_t verifyntz,int32_t *ntzheightp,uint256 *blockhashp,uint256 *desttxidp,CTransaction tx)
{
int32_t numsigs=0; uint8_t elected[64][33]; char *symbol; std::vector<uint8_t> opret; uint32_t nTime;
char *symbol; std::vector<uint8_t> opret;
AssertLockHeld(cs_main);

if ( tx.vout.size() >= 2 )
Expand All @@ -662,13 +662,19 @@ int32_t NSPV_notarizationextract(int32_t verifyntz,int32_t *ntzheightp,uint256 *
{
//sleep(1); // needed to avoid no pnodes error
*desttxidp = NSPV_opretextract(ntzheightp,blockhashp,symbol,opret,tx.GetHash());
nTime = NSPV_blocktime(*ntzheightp);
komodo_notaries(elected,*ntzheightp,nTime);
if ( verifyntz != 0 && (numsigs= NSPV_fastnotariescount(tx,elected,nTime)) < 12 )
if (verifyntz != 0)
{
LogPrintf("%s error numsigs.%d less than 12\n", __func__, numsigs);
return(-3);
}
uint32_t nTime = NSPV_blocktime(*ntzheightp);
int32_t numsigs=0;
uint8_t elected[64][33];

komodo_notaries(elected,*ntzheightp,nTime);
if ((numsigs= NSPV_fastnotariescount(tx,elected,nTime)) < 12 )
{
LogPrintf("%s error notaries numsigs.%d less than required min 12\n", __func__, numsigs);
return(-3);
}
}
return(0);
}
else
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/tokensrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1184,7 +1184,7 @@ static const CRPCCommand commands[] =
{ "tokens v2", "mytokenv2orders", &mytokenv2orders, true },
{ "tokens", "tokenaddress", &tokenaddress, true },
{ "tokens v2", "tokenv2address", &tokenv2address, true },
// { "tokens v2", "tokenv2indexkey", &tokenv2indexkey, true },
{ "tokens v2", "tokenv2indexkey", &tokenv2indexkey, true },
{ "tokens", "tokenbalance", &tokenbalance, true },
{ "tokens v2", "tokenv2balance", &tokenv2balance, true },
{ "tokens", "tokenallbalances", &tokenallbalances, true },
Expand Down
1 change: 0 additions & 1 deletion src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,6 @@ UniValue sendtoaddress(const UniValue& params, bool fHelp, const CPubKey& mypk)
"5. subtractfeefromamount (boolean, optional, default=false) The fee will be deducted from the amount being sent.\n"
" The recipient will receive less " + strprintf("%s",komodo_chainname()) + " than you enter in the amount field.\n"
"6. oprethexstr\n"
"7. unlocktime (numeric, optional) timestamp or blockheight when the sent funds will be unlocked by CLTV opcode\n"
"\nResult:\n"
"\"transactionid\" (string) The transaction id.\n"
"\nExamples:\n"
Expand Down
7 changes: 0 additions & 7 deletions zcutil/build-mac.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,6 @@ make "$@" -C ./depends/ V=1 NO_QT=1 NO_PROTON=1
# ./makecustom
# cd $WD

# build cryptoconditions
cd ./src/cryptoconditions
./autogen.sh
./configure
make
cd ../..

./autogen.sh
CPPFLAGS="-I$PREFIX/include -arch x86_64" LDFLAGS="-L$PREFIX/lib -arch x86_64 -Wl,-no_pie" \
CXXFLAGS="-arch x86_64 -I/usr/local/Cellar/gcc\@8/8.3.0/include/c++/8.3.0/ -fwrapv -fno-strict-aliasing -Wno-builtin-declaration-mismatch -Werror -Wno-error=attributes -g -Wl,-undefined -Wl,dynamic_lookup" \
Expand Down
7 changes: 0 additions & 7 deletions zcutil/build-win.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ cd "$(dirname "$(readlink -f "$0")")/.."
cd depends/ && make HOST=$HOST V=1 NO_QT=1
cd ../

# build cryptoconditions
cd ./src/cryptoconditions
./autogen.sh
./configure --host=x86_64-w64-mingw32 --enable-static --disable-shared
CC="${CC} -g " CXX="${CXX} -g " make V=1
cd ../..

# note: cclib building now added to src/Makefile.am
#BUILD CCLIB
# WD=$PWD
Expand Down
7 changes: 0 additions & 7 deletions zcutil/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,6 @@ eval "$MAKE" --version
as --version
ld -v

# build cryptoconditions
cd ./src/cryptoconditions
./autogen.sh
./configure
make
cd ../..

HOST="$HOST" BUILD="$BUILD" NO_PROTON="$PROTON_ARG" "$MAKE" "$@" -C ./depends/ V=1
./autogen.sh

Expand Down

0 comments on commit 0816254

Please sign in to comment.