mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-09 14:28:22 +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())
|
||||
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
|
||||
if (fCheckMerkleRoot && block.hashMerkleRoot != block.BuildMerkleTree())
|
||||
return state.DoS(100, error("CheckBlock() : hashMerkleRoot mismatch"));
|
||||
|
Loading…
Reference in New Issue
Block a user