mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-09 22:37:55 +00:00
Check duplicate usernames within the same block
This commit is contained in:
parent
5529ce130c
commit
ceddb2781b
@ -1599,6 +1599,15 @@ bool CheckBlock(const CBlock& block, CValidationState& state, bool fCheckPOW, bo
|
|||||||
if (uniqueTx.size() != block.vtx.size())
|
if (uniqueTx.size() != block.vtx.size())
|
||||||
return state.DoS(100, error("CheckBlock() : duplicate transaction"));
|
return state.DoS(100, error("CheckBlock() : duplicate transaction"));
|
||||||
|
|
||||||
|
// Check duplicate usernames within the same block
|
||||||
|
set<uint256> uniqueUsers;
|
||||||
|
for (unsigned int i = 1; i < block.vtx.size(); i++) {
|
||||||
|
uniqueUsers.insert(block.vtx[i].GetUsernameHash());
|
||||||
|
}
|
||||||
|
if (uniqueUsers.size() != block.vtx.size()-1)
|
||||||
|
return state.DoS(100, error("CheckBlock() : duplicate username"));
|
||||||
|
|
||||||
|
|
||||||
// Check merkle root
|
// Check merkle root
|
||||||
if (fCheckMerkleRoot && block.hashMerkleRoot != block.BuildMerkleTree())
|
if (fCheckMerkleRoot && block.hashMerkleRoot != block.BuildMerkleTree())
|
||||||
return state.DoS(100, error("CheckBlock() : hashMerkleRoot mismatch"));
|
return state.DoS(100, error("CheckBlock() : hashMerkleRoot mismatch"));
|
||||||
|
Loading…
Reference in New Issue
Block a user