Filter duplicate validates

This commit is contained in:
jl777
2018-07-21 10:12:44 -11:00
parent 2ab9183cd7
commit b712e32f63
2 changed files with 12 additions and 13 deletions

View File

@@ -1113,8 +1113,11 @@ bool AssetValidate(Eval* eval,CTransaction &tx,int32_t numvouts,uint8_t funcid,u
bool ProcessAssets(Eval* eval, std::vector<uint8_t> paramsNull,const CTransaction &ctx, unsigned int nIn)
{
static uint256 zero;
CTransaction createTx; uint256 assetid,assetid2,hashBlock; uint8_t funcid; int32_t i,n; uint64_t amount; std::vector<uint8_t> origpubkey;
static uint256 zero,prevtxid;
CTransaction createTx; uint256 txid,assetid,assetid2,hashBlock; uint8_t funcid; int32_t i,n; uint64_t amount; std::vector<uint8_t> origpubkey;
txid = tx.GetHash();
if ( txid == prevtxid )
return(true);
CTransaction tx = *(CTransaction *)&ctx;
fprintf(stderr,"Process assets\n");
if ( paramsNull.size() != 0 ) // Don't expect params
@@ -1129,5 +1132,9 @@ bool ProcessAssets(Eval* eval, std::vector<uint8_t> paramsNull,const CTransactio
fprintf(stderr,"done checking assetid tx\n");
if ( assetid2 != zero && eval->GetTxUnconfirmed(assetid2,createTx,hashBlock) == 0 )
return eval->Invalid("cant find asset2 create txid");
return(AssetValidate(eval,tx,n,funcid,assetid,assetid2,amount,origpubkey));
if ( AssetValidate(eval,tx,n,funcid,assetid,assetid2,amount,origpubkey) != 0 )
{
prevtxid = txid;
return(true);
} else return(false);
}

View File

@@ -634,8 +634,6 @@ void komodo_broadcast(CBlock *pblock,int32_t limit)
//fprintf(stderr,"finished broadcast new block t.%u\n",(uint32_t)time(NULL));
}
extern uint32_t ASSETCHAINS_CC;
static bool ProcessBlockFound(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey)
#else
static bool ProcessBlockFound(CBlock* pblock)
@@ -673,7 +671,6 @@ static bool ProcessBlockFound(CBlock* pblock)
}
}
// Track how many getdata requests this block gets
fprintf(stderr,"maprequestcount\n");
//if ( 0 )
{
LOCK(wallet.cs_wallet);
@@ -683,16 +680,11 @@ static bool ProcessBlockFound(CBlock* pblock)
// Process this block the same as if we had received it from another node
CValidationState state;
fprintf(stderr,"processnewblock\n");
if (!ProcessNewBlock(1,chainActive.LastTip()->nHeight+1,state, NULL, pblock, true, NULL))
return error("KomodoMiner: ProcessNewBlock, block not accepted");
fprintf(stderr,"track mined block\n");
TrackMinedBlock(pblock->GetHash());
fprintf(stderr,"komodo_broadcast\n");
if ( ASSETCHAINS_CC == 0 )
komodo_broadcast(pblock,16);
fprintf(stderr,"done processblockfound\n");
komodo_broadcast(pblock,16);
return true;
}