Merge bitcoin/bitcoin#21129: fuzz: check that ser+unser produces the same AddrMan

87651795d8 fuzz: check that ser+unser produces the same AddrMan (Vasil Dimov)
6408b24517 fuzz: move init code to the CAddrManDeterministic constructor (Vasil Dimov)

Pull request description:

  Add a fuzz test that fills addrman with a pile of randomly generated addresses, serializes it to a stream, unserializes the stream to another addrman object and compares the two.

  Some discussion of this already happened at https://github.com/jnewbery/bitcoin/pull/18.

ACKs for top commit:
  practicalswift:
    cr ACK 87651795d8
  jonatack:
    ACK 87651795d8 rebased to current master, reviewed, fuzz build, ran `FUZZ=addrman_serdeser src/test/fuzz/fuzz`

Tree-SHA512: 7eda79279f14f2649840bf752e575d7b02cbaad541f74f7254855ebd4a32da988f042d78aa9228983350283bb74dd0c71f51f04c0846889c3ba2f19f01a0c303
This commit is contained in:
MarcoFalke
2021-08-05 15:17:44 +02:00
2 changed files with 215 additions and 11 deletions

View File

@@ -58,6 +58,7 @@ private:
mutable int nRandomPos{-1};
friend class CAddrMan;
friend class CAddrManDeterministic;
public:
@@ -778,6 +779,7 @@ private:
void SetServices_(const CService &addr, ServiceFlags nServices) EXCLUSIVE_LOCKS_REQUIRED(cs);
friend class CAddrManTest;
friend class CAddrManDeterministic;
};
#endif // BITCOIN_ADDRMAN_H