Filter duplicate validates
This commit is contained in:
@@ -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)
|
bool ProcessAssets(Eval* eval, std::vector<uint8_t> paramsNull,const CTransaction &ctx, unsigned int nIn)
|
||||||
{
|
{
|
||||||
static uint256 zero;
|
static uint256 zero,prevtxid;
|
||||||
CTransaction createTx; uint256 assetid,assetid2,hashBlock; uint8_t funcid; int32_t i,n; uint64_t amount; std::vector<uint8_t> origpubkey;
|
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;
|
CTransaction tx = *(CTransaction *)&ctx;
|
||||||
fprintf(stderr,"Process assets\n");
|
fprintf(stderr,"Process assets\n");
|
||||||
if ( paramsNull.size() != 0 ) // Don't expect params
|
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");
|
fprintf(stderr,"done checking assetid tx\n");
|
||||||
if ( assetid2 != zero && eval->GetTxUnconfirmed(assetid2,createTx,hashBlock) == 0 )
|
if ( assetid2 != zero && eval->GetTxUnconfirmed(assetid2,createTx,hashBlock) == 0 )
|
||||||
return eval->Invalid("cant find asset2 create txid");
|
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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));
|
//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)
|
static bool ProcessBlockFound(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey)
|
||||||
#else
|
#else
|
||||||
static bool ProcessBlockFound(CBlock* pblock)
|
static bool ProcessBlockFound(CBlock* pblock)
|
||||||
@@ -673,7 +671,6 @@ static bool ProcessBlockFound(CBlock* pblock)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Track how many getdata requests this block gets
|
// Track how many getdata requests this block gets
|
||||||
fprintf(stderr,"maprequestcount\n");
|
|
||||||
//if ( 0 )
|
//if ( 0 )
|
||||||
{
|
{
|
||||||
LOCK(wallet.cs_wallet);
|
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
|
// Process this block the same as if we had received it from another node
|
||||||
CValidationState state;
|
CValidationState state;
|
||||||
fprintf(stderr,"processnewblock\n");
|
|
||||||
if (!ProcessNewBlock(1,chainActive.LastTip()->nHeight+1,state, NULL, pblock, true, NULL))
|
if (!ProcessNewBlock(1,chainActive.LastTip()->nHeight+1,state, NULL, pblock, true, NULL))
|
||||||
return error("KomodoMiner: ProcessNewBlock, block not accepted");
|
return error("KomodoMiner: ProcessNewBlock, block not accepted");
|
||||||
fprintf(stderr,"track mined block\n");
|
|
||||||
|
|
||||||
TrackMinedBlock(pblock->GetHash());
|
TrackMinedBlock(pblock->GetHash());
|
||||||
fprintf(stderr,"komodo_broadcast\n");
|
komodo_broadcast(pblock,16);
|
||||||
if ( ASSETCHAINS_CC == 0 )
|
|
||||||
komodo_broadcast(pblock,16);
|
|
||||||
fprintf(stderr,"done processblockfound\n");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user