aboutsummaryrefslogtreecommitdiff
path: root/src/addrman_impl.h
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2021-11-01 10:28:30 +0800
committerfanquake <fanquake@gmail.com>2021-11-01 10:58:27 +0800
commit994aaaa88d414953338aa955f12ad7fc9480dddc (patch)
tree7ddeaa25b6fd70028c75d369bc6c14e4c2d22bb5 /src/addrman_impl.h
parent7efc628539573af4b4a76d93b853cc46e9e52eae (diff)
parent61ec0539b26a902a41a2602187a71f9dba3c6935 (diff)
downloadbitcoin-994aaaa88d414953338aa955f12ad7fc9480dddc.tar.xz
Merge bitcoin/bitcoin#23380: addrman: Fix AddrMan::Add() return semantics and logging
61ec0539b26a902a41a2602187a71f9dba3c6935 [MOVEONLY] reorder functions in addrman_impl.h and addrman.cpp (John Newbery) 2095df7b7bfcb9ab0c5710a93112f7f341e753c9 [addrman] Add Add_() inner function, fix Add() return semantics (John Newbery) 2658eb6d68460272deefb3fcc653b03f6ec6e7cf [addrman] Rename Add_() to AddSingle() (John Newbery) e58598e833d5737900fe3c4369e26f2a08166892 [addrman] Add doxygen comment to AddrMan::Add() (John Newbery) Pull request description: Previously, Add() would return true if the function created a new AddressInfo object, even if that object could not be successfully entered into the new table and was deleted. That would happen if the new table position was already taken and the existing entry could not be removed. Instead, return true if the new AddressInfo object is successfully entered into the new table. This fixes a bug in the "Added %i addresses" log, which would not always accurately log how many addresses had been added. ACKs for top commit: naumenkogs: ACK 61ec0539b26a902a41a2602187a71f9dba3c6935 mzumsande: ACK 61ec0539b26a902a41a2602187a71f9dba3c6935 shaavan: ACK 61ec0539b26a902a41a2602187a71f9dba3c6935 Tree-SHA512: 276f1e8297d4b6d411d05d06ffc7c176f6290a784da039926ab6c471a8ed8e9159ab4f56c893b1285737ae292954930f0d28012d89dfb3f2f825d7df41016feb
Diffstat (limited to 'src/addrman_impl.h')
-rw-r--r--src/addrman_impl.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/addrman_impl.h b/src/addrman_impl.h
index e8e7c15a19..e097932ee8 100644
--- a/src/addrman_impl.h
+++ b/src/addrman_impl.h
@@ -243,9 +243,13 @@ private:
//! Move an entry from the "new" table(s) to the "tried" table
void MakeTried(AddrInfo& info, int nId) EXCLUSIVE_LOCKS_REQUIRED(cs);
+ /** Attempt to add a single address to addrman's new table.
+ * @see AddrMan::Add() for parameters. */
+ bool AddSingle(const CAddress& addr, const CNetAddr& source, int64_t nTimePenalty) EXCLUSIVE_LOCKS_REQUIRED(cs);
+
void Good_(const CService& addr, bool test_before_evict, int64_t time) EXCLUSIVE_LOCKS_REQUIRED(cs);
- bool Add_(const CAddress& addr, const CNetAddr& source, int64_t nTimePenalty) EXCLUSIVE_LOCKS_REQUIRED(cs);
+ bool Add_(const std::vector<CAddress> &vAddr, const CNetAddr& source, int64_t nTimePenalty) EXCLUSIVE_LOCKS_REQUIRED(cs);
void Attempt_(const CService& addr, bool fCountFailure, int64_t nTime) EXCLUSIVE_LOCKS_REQUIRED(cs);