Browse Source

test invalid userhash (might be an invalid tx received from network)

miguelfreitas
Miguel Freitas 12 years ago
parent
commit
a6ff5511fa
  1. 2
      src/core.cpp
  2. 2
      src/main.cpp

2
src/core.cpp

@ -84,7 +84,7 @@ uint256 CTransaction::GetUsernameHash() const @@ -84,7 +84,7 @@ uint256 CTransaction::GetUsernameHash() const
return SerializeHash(userName.ExtractSmallString());
}
// [MF] TODO: remove this assert later, it will fail for spammessage.
assert(!"username not small string");
//assert(!"username not small string");
return uint256();
}

2
src/main.cpp

@ -494,6 +494,8 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state) @@ -494,6 +494,8 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state)
return state.DoS(10, error("CheckTransaction() : pubKey empty"));
if (!tx.userName.IsSmallString())
return state.DoS(10, error("CheckTransaction() : username not smallstring"));
if (tx.GetUsernameHash() == uint256())
return state.DoS(10, error("CheckTransaction() : username hash error"));
if (!CheckUsername( tx.userName.ExtractSmallString(), state ))
return state.DoS(10, error("CheckTransaction() : username check failed"));
}

Loading…
Cancel
Save