fix validation
This commit is contained in:
@@ -1025,7 +1025,7 @@ int32_t komodo_connectblock(bool fJustCheck, CBlockIndex *pindex,CBlock& block)
|
|||||||
return(0);
|
return(0);
|
||||||
if ( notarisations.size() == 1 && notarisations[0] == 1 )
|
if ( notarisations.size() == 1 && notarisations[0] == 1 )
|
||||||
return(1);
|
return(1);
|
||||||
if ( notarisations.size() > 1 )
|
if ( notarisations.size() > 1 || (notarisations.size() == 1 && notarisations[0] != 1) )
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
else return(0);
|
else return(0);
|
||||||
|
|||||||
@@ -3248,7 +3248,6 @@ static int64_t nTimeTotal = 0;
|
|||||||
bool FindBlockPos(int32_t tmpflag,CValidationState &state, CDiskBlockPos &pos, unsigned int nAddSize, unsigned int nHeight, uint64_t nTime, bool fKnown = false);
|
bool FindBlockPos(int32_t tmpflag,CValidationState &state, CDiskBlockPos &pos, unsigned int nAddSize, unsigned int nHeight, uint64_t nTime, bool fKnown = false);
|
||||||
bool ReceivedBlockTransactions(const CBlock &block, CValidationState& state, CBlockIndex *pindexNew, const CDiskBlockPos& pos);
|
bool ReceivedBlockTransactions(const CBlock &block, CValidationState& state, CBlockIndex *pindexNew, const CDiskBlockPos& pos);
|
||||||
|
|
||||||
|
|
||||||
bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pindex, CCoinsViewCache& view, bool fJustCheck,bool fCheckPOW)
|
bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pindex, CCoinsViewCache& view, bool fJustCheck,bool fCheckPOW)
|
||||||
{
|
{
|
||||||
CDiskBlockPos blockPos;
|
CDiskBlockPos blockPos;
|
||||||
@@ -3288,9 +3287,9 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
|
|||||||
// do a full block scan to get notarisation position and to enforce a valid notarization is in position 1.
|
// do a full block scan to get notarisation position and to enforce a valid notarization is in position 1.
|
||||||
// if notarisation in the block, must be position 1 and the coinbase must pay notaries.
|
// if notarisation in the block, must be position 1 and the coinbase must pay notaries.
|
||||||
int notarisationTx = komodo_connectblock(true,pindex,*(CBlock *)&block);
|
int notarisationTx = komodo_connectblock(true,pindex,*(CBlock *)&block);
|
||||||
// -1 means that the valid notarization isnt in position 1.
|
// -1 means that the valid notarization isnt in position 1 or there are too many notarizations in this block.
|
||||||
if ( notarisationTx == -1 )
|
if ( notarisationTx == -1 )
|
||||||
return state.DoS(100, error("ConnectBlock(): Notarisation is not in TX position 1! Invalid Block!"),
|
return state.DoS(100, error("ConnectBlock(): Notarization is not in TX position 1 or block contains more than 1 notarization! Invalid Block!"),
|
||||||
REJECT_INVALID, "bad-notarization-position");
|
REJECT_INVALID, "bad-notarization-position");
|
||||||
// 1 means this block contains a valid notarisation and its in position 1.
|
// 1 means this block contains a valid notarisation and its in position 1.
|
||||||
// its no longer possible for any attempted notarization to be in a block with a valid one!
|
// its no longer possible for any attempted notarization to be in a block with a valid one!
|
||||||
|
|||||||
Reference in New Issue
Block a user