diff options
author | josibake <josibake@protonmail.com> | 2021-12-10 15:37:04 +0100 |
---|---|---|
committer | josibake <josibake@protonmail.com> | 2021-12-14 17:50:24 +0100 |
commit | 207f1c825c632c54af009516d376d392ea9106fa (patch) | |
tree | 64768e913db4051ecff273c4bd49907545cde1e0 /src/addrman.h | |
parent | 5dd28e5cff8a8177b969181ecb58d045e7f80a72 (diff) |
refactor: make AddrMan::Good return bool
If AddrMan::Good is unable to add an entry
to tried (for a number of reasons), return false.
This makes it much easier and cleaner to directly
test for tried collisions. It also allows anyone
calling Good() to handle the case where adding an
address to tried is unsuccessful.
Update docs to doxygen style.
Diffstat (limited to 'src/addrman.h')
-rw-r--r-- | src/addrman.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/addrman.h b/src/addrman.h index 455d84ca71..e9bc372380 100644 --- a/src/addrman.h +++ b/src/addrman.h @@ -81,8 +81,14 @@ public: * @return true if at least one address is successfully added. */ bool Add(const std::vector<CAddress>& vAddr, const CNetAddr& source, int64_t nTimePenalty = 0); - //! Mark an entry as accessible, possibly moving it from "new" to "tried". - void Good(const CService& addr, int64_t nTime = GetAdjustedTime()); + /** + * Mark an address record as accessible and attempt to move it to addrman's tried table. + * + * @param[in] addr Address record to attempt to move to tried table. + * @param[in] nTime The time that we were last connected to this peer. + * @return true if the address is successfully moved from the new table to the tried table. + */ + bool Good(const CService& addr, int64_t nTime = GetAdjustedTime()); //! Mark an entry as connection attempted to. void Attempt(const CService& addr, bool fCountFailure, int64_t nTime = GetAdjustedTime()); |