getCertifiedAddrBook function
GetCertifiedAddrBook is a helper to "upcast" an AddrBook to a CertifiedAddrBook by using type assertion. If the given AddrBook is also a CertifiedAddrBook, it will be returned, and the ok return value will be true. Returns (null, false) if the AddrBook is not a CertifiedAddrBook.
Note that since Peerstore embeds the AddrBook interface, you can also call GetCertifiedAddrBook(myPeerstore).
Implementation
(bool, CertifiedAddrBook?) getCertifiedAddrBook(dynamic ab) {
if (ab is CertifiedAddrBook) {
return (true, ab);
}
return (false, null);
}