diff --git a/src/node/address.cc b/src/node/address.cc index 2979239c4..74993a0b4 100644 --- a/src/node/address.cc +++ b/src/node/address.cc @@ -40,6 +40,12 @@ Address::operator = (const Address &address) return *this; } +bool +Address::IsInvalid (void) const +{ + return m_len == 0 && m_type == 0; +} + uint8_t Address::GetLength (void) const { diff --git a/src/node/address.h b/src/node/address.h index 20ea4b46f..7d234fd72 100644 --- a/src/node/address.h +++ b/src/node/address.h @@ -86,6 +86,14 @@ public: Address (const Address & address); Address &operator = (const Address &address); + /** + * \returns true if this address is invalid, false otherwise. + * + * An address is invalid if and only if it was created + * through the default constructor and it was never + * re-initialized. + */ + bool IsInvalid (void); /** * \returns the length of the underlying address. */