Delete more CCs #381
This commit is contained in:
@@ -37,32 +37,6 @@ extern pthread_mutex_t HUSH_CC_mutex;
|
||||
|
||||
bool RunCCEval(const CC *cond, const CTransaction &tx, unsigned int nIn)
|
||||
{
|
||||
EvalRef eval;
|
||||
pthread_mutex_lock(&HUSH_CC_mutex);
|
||||
bool out = eval->Dispatch(cond, tx, nIn);
|
||||
pthread_mutex_unlock(&HUSH_CC_mutex);
|
||||
if ( eval->state.IsValid() != out)
|
||||
fprintf(stderr,"out %d vs %d isValid\n",(int32_t)out,(int32_t)eval->state.IsValid());
|
||||
//assert(eval->state.IsValid() == out);
|
||||
|
||||
if (eval->state.IsValid()) return true;
|
||||
|
||||
std::string lvl = eval->state.IsInvalid() ? "Invalid" : "Error!";
|
||||
fprintf(stderr, "CC Eval %s %s: %s spending tx %s\n",
|
||||
EvalToStr(cond->code[0]).data(),
|
||||
lvl.data(),
|
||||
eval->state.GetRejectReason().data(),
|
||||
tx.vin[nIn].prevout.hash.GetHex().data());
|
||||
if (eval->state.IsError()) fprintf(stderr, "Culprit: %s\n", EncodeHexTx(tx).data());
|
||||
CTransaction tmp;
|
||||
if (mempool.lookup(tx.GetHash(), tmp))
|
||||
{
|
||||
// This is to remove a payments airdrop if it gets stuck in the mempool.
|
||||
// Miner will mine 1 invalid block, but doesnt stop them mining until a restart.
|
||||
// This would almost never happen in normal use.
|
||||
std::list<CTransaction> dummy;
|
||||
mempool.remove(tx,dummy,true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -72,51 +46,7 @@ bool RunCCEval(const CC *cond, const CTransaction &tx, unsigned int nIn)
|
||||
*/
|
||||
bool Eval::Dispatch(const CC *cond, const CTransaction &txTo, unsigned int nIn)
|
||||
{
|
||||
struct CCcontract_info *cp;
|
||||
if (cond->codeLength == 0)
|
||||
return Invalid("empty-eval");
|
||||
|
||||
uint8_t ecode = cond->code[0];
|
||||
if ( ASSETCHAINS_CCDISABLES[ecode] != 0 )
|
||||
{
|
||||
// check if a height activation has been set.
|
||||
if ( mapHeightEvalActivate[ecode] == 0 || this->GetCurrentHeight() == 0 || mapHeightEvalActivate[ecode] > this->GetCurrentHeight() )
|
||||
{
|
||||
fprintf(stderr,"%s evalcode.%d %02x\n",txTo.GetHash().GetHex().c_str(),ecode,ecode);
|
||||
fprintf(stderr, "ac_ccactivateht: evalcode.%i activates at height.%i vs current height.%i\n", ecode, mapHeightEvalActivate[ecode], this->GetCurrentHeight());
|
||||
return Invalid("disabled-code, -ac_ccenables didnt include this ecode");
|
||||
}
|
||||
}
|
||||
std::vector<uint8_t> vparams(cond->code+1, cond->code+cond->codeLength);
|
||||
if ( ecode >= EVAL_FIRSTUSER && ecode <= EVAL_LASTUSER )
|
||||
{
|
||||
if ( ASSETCHAINS_CCLIB.size() > 0 && ASSETCHAINS_CCLIB == CClib_name() )
|
||||
return CClib_Dispatch(cond,this,vparams,txTo,nIn);
|
||||
else return Invalid("mismatched -ac_cclib vs CClib_name");
|
||||
}
|
||||
cp = &CCinfos[(int32_t)ecode];
|
||||
if ( cp->didinit == 0 )
|
||||
{
|
||||
CCinit(cp,ecode);
|
||||
cp->didinit = 1;
|
||||
}
|
||||
|
||||
switch ( ecode )
|
||||
{
|
||||
/*
|
||||
case EVAL_IMPORTPAYOUT:
|
||||
return ImportPayout(vparams, txTo, nIn);
|
||||
break;
|
||||
|
||||
case EVAL_IMPORTCOIN:
|
||||
return ImportCoin(vparams, txTo, nIn);
|
||||
break;
|
||||
*/
|
||||
default:
|
||||
return(ProcessCC(cp,this, vparams, txTo, nIn));
|
||||
break;
|
||||
}
|
||||
return Invalid("invalid-code, dont forget to add EVAL_NEWCC to Eval::Dispatch");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -129,21 +59,13 @@ bool Eval::GetSpendsConfirmed(uint256 hash, std::vector<CTransaction> &spends) c
|
||||
|
||||
bool Eval::GetTxUnconfirmed(const uint256 &hash, CTransaction &txOut, uint256 &hashBlock) const
|
||||
{
|
||||
return(myGetTransaction(hash, txOut,hashBlock));
|
||||
/*if (!myGetTransaction(hash, txOut,hashBlock)) {
|
||||
return(myGetTransaction(hash, txOut,hashBlock));
|
||||
} else return(true);*/
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Eval::GetTxConfirmed(const uint256 &hash, CTransaction &txOut, CBlockIndex &block) const
|
||||
{
|
||||
uint256 hashBlock;
|
||||
if (!GetTxUnconfirmed(hash, txOut, hashBlock))
|
||||
return false;
|
||||
if (hashBlock.IsNull() || !GetBlock(hashBlock, block))
|
||||
return false;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
unsigned int Eval::GetCurrentHeight() const
|
||||
@@ -153,12 +75,6 @@ unsigned int Eval::GetCurrentHeight() const
|
||||
|
||||
bool Eval::GetBlock(uint256 hash, CBlockIndex& blockIdx) const
|
||||
{
|
||||
auto r = mapBlockIndex.find(hash);
|
||||
if (r != mapBlockIndex.end()) {
|
||||
blockIdx = *r->second;
|
||||
return true;
|
||||
}
|
||||
fprintf(stderr, "CC Eval Error: Can't get block from index\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -172,13 +88,7 @@ int32_t Eval::GetNotaries(uint8_t pubkeys[64][33], int32_t height, uint32_t time
|
||||
|
||||
bool Eval::CheckNotaryInputs(const CTransaction &tx, uint32_t height, uint32_t timestamp) const
|
||||
{
|
||||
if (tx.vin.size() < 11) return false;
|
||||
|
||||
CrosschainAuthority auth;
|
||||
auth.requiredSigs = 11;
|
||||
auth.size = GetNotaries(auth.notaries, height, timestamp);
|
||||
|
||||
return CheckTxAuthority(tx, auth);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get MoM from a notarization tx hash (on HUSH)
|
||||
@@ -208,6 +118,7 @@ std::string Eval::GetAssetchainsSymbol() const
|
||||
/*
|
||||
* Notarization data, ie, OP_RETURN payload in notarization transactions
|
||||
*/
|
||||
// This is used by notarizationdb.cpp
|
||||
bool ParseNotarizationOpReturn(const CTransaction &tx, NotarizationData &data)
|
||||
{
|
||||
if (tx.vout.size() < 2) return false;
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/bin/sh
|
||||
gcc -O3 -DBUILD_GAMESCC -std=c++11 -I../secp256k1/include -I../univalue/include -I../cryptoconditions/include -I../cryptoconditions/src -I../cryptoconditions/src/asn -I.. -I. -fPIC -shared -c -o gamescc.so cclib.cpp
|
||||
cp gamescc.so ../libcc.so
|
||||
cd ..
|
||||
make
|
||||
cd cc
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Copyright 2016-2023 The Hush developers
|
||||
cd rogue;
|
||||
make clean;
|
||||
|
||||
if [ "$HOST" = "x86_64-w64-mingw32" ]; then
|
||||
echo "Not supported"
|
||||
exit 1
|
||||
./configure --host=x86_64-w64-mingw32
|
||||
echo $PWD
|
||||
# wget ...
|
||||
tar xvfz x86_64-w64-mingw32.tar.gz && rm x86_64-w64-mingw32.tar.gz
|
||||
echo lib archive cleaned
|
||||
echo $PWD
|
||||
if make -f Makefile_win "$@"; then
|
||||
echo rogue.exe build SUCCESSFUL
|
||||
cd ..
|
||||
else
|
||||
echo rogue.exe build FAILED
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo building rogue...
|
||||
./configure
|
||||
if make "$@"; then
|
||||
echo rogue build SUCCESSFUL
|
||||
cd ..
|
||||
else
|
||||
echo rogue build FAILED
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if make -f Makefile_rogue "$@"; then
|
||||
echo ROGUE BUILD SUCCESSFUL
|
||||
else
|
||||
echo ROGUE BUILD FAILED
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user