IsIDPubNonceValid returns if `id == HashBlock(key, nonce)`.
(id *proto.RawNodeID, nonce *mine.Uint256, key *asymmetric.PublicKey)
| 270 | |
| 271 | // IsIDPubNonceValid returns if `id == HashBlock(key, nonce)`. |
| 272 | func IsIDPubNonceValid(id *proto.RawNodeID, nonce *mine.Uint256, key *asymmetric.PublicKey) bool { |
| 273 | if key == nil || id == nil || nonce == nil { |
| 274 | return false |
| 275 | } |
| 276 | keyHash := mine.HashBlock(key.Serialize(), *nonce) |
| 277 | return keyHash.IsEqual(&id.Hash) |
| 278 | } |
| 279 | |
| 280 | // setNode sets id and its publicKey. |
| 281 | func setNode(nodeInfo *proto.Node) (err error) { |