<!-- This issue tracker is only for technical issues related to Bitcoin Core.

General bitcoin questions and/or support requests are best directed to the Bitcoin StackExchange at https://bitcoin.stackexchange.com.

For reporting security issues, please read instructions at https://bitcoincore.org/en/contact/.

If the node is "stuck" during sync or giving "block checksum mismatch" errors, please ensure your hardware is stable by running memtest and observe CPU temperature with a load-test tool such as linpack before creating an issue! -->

<!-- Describe the issue -->
**Describe**
Hi all,
Bitcoin fails to build on MSVC due to waring c4858. Could you help look?
**Expected behavior**
Build successfully.
<!--- What behavior did you expect? -->

**Actual behavior**
F:\gitP\bitcoin\bitcoin\src\sync.h(168): error C2220: the following warning is treated as an error
F:\gitP\bitcoin\bitcoin\src\sync.h(166): note: while compiling class template member function 'bool UniqueLock<_Ty,std::unique_lock<PARENT>>::TryEnter(const char *,const char *,int)'
        with
        [
            _Ty=RecursiveMutex,
            PARENT=std::recursive_mutex
        ]
F:\gitP\bitcoin\bitcoin\src\sync.h(179): note: see reference to function template instantiation 'bool UniqueLock<_Ty,std::unique_lock<PARENT>>::TryEnter(const char *,const char *,int)' being compiled
        with
        [
            _Ty=RecursiveMutex,
            PARENT=std::recursive_mutex
        ]
F:\gitP\bitcoin\bitcoin\src\net.h(822): note: see reference to class template instantiation 'UniqueLock<_Ty,std::unique_lock<PARENT>>' being compiled
        with
        [
            _Ty=RecursiveMutex,
            PARENT=std::recursive_mutex
        ]
F:\gitP\bitcoin\bitcoin\src\sync.h(168): warning C4858: discarding return value: This function returns whether the operation succeeded in modifying object state. It is dangerous to ignore the return value.
**Detail log**
[Uploading build (3).log…]()
<!--- What was the actual behavior (provide screenshots if the issue is GUI-related)? -->

**To reproduce**
1. git clone https://github.com/bitcoin/bitcoin F:\gitP\bitcoin\bitcoin
2. cd F:\gitP\bitcoin\bitcoin\build_msvc
3. py -3 msvc-autogen.py
4. cd F:\gitP\bitcoin\tools\vcpkg
5. git -C "F:\gitP\bitcoin\tools\vcpkg" clean -xdf 2>&1
6. bootstrap-vcpkg.bat 2>&1
7.  set path=%cd%;%path%
8. cd F:\gitP\bitcoin\bitcoin\build_msvc
9.  msbuild /m /p:Platform=x64 /p:Configuration=Release bitcoin.sln /t:Rebuild 2>&1
<!--- How reliably can you reproduce the issue, what are the steps to do so? -->

**System information**
VS version: VS2019 (16.11.11)
Operating system: windows server 2019
the commit of Bitcoin we use is 5174a13

**workaround**
I modified the common.init.vcxproj.in file of this text like below to solve this issue:
\<DisableSpecificWarnings\>4018;4244;4267;4334;4715;4805;4834\</DisableSpecificWarnings\>
to be:
\<DisableSpecificWarnings\>4018;4244;4267;4334;4715;4805;4834;4858\</DisableSpecificWarnings\>
<!-- What version of Bitcoin Core are you using, where did you get it (website, self-compiled, etc)? -->

<!-- What type of machine are you observing the error on (OS/CPU and disk type)? -->

<!-- GUI-related issue? What is your operating system and its version? If Linux, what is your desktop environment and graphical shell? -->

<!-- Any extra information that might be useful in the debugging process. -->
<!--- This is normally the contents of a `debug.log` or `config.log` file. Raw text or a link to a pastebin type site are preferred. -->

template <typename MutexType>
inline void AssertLockHeldInternal(const char* pszName, const char* pszFile, int nLine, MutexType* cs) EXCLUSIVE_LOCKS_REQUIRED(cs) {}
template <typename MutexType>
void AssertLockNotHeldInternal(const char* pszName, const char* pszFile, int nLine, MutexType* cs) LOCKS_EXCLUDED(cs) {}
inline void DeleteLock(void* cs) {}
inline bool LockStackEmpty() { return true; }
#endif
/**
 * Template mixin that adds -Wthread-safety locking annotations and lock order
 * checking to a subset of the mutex API.
 */
template <typename PARENT>
class LOCKABLE AnnotatedMixin : public PARENT
{
public:
    ~AnnotatedMixin() {
        DeleteLock((void*)this);
    }
    void lock() EXCLUSIVE_LOCK_FUNCTION()
    {
        PARENT::lock();
    }
    void unlock() UNLOCK_FUNCTION()
    {
        PARENT::unlock();
    }
    bool try_lock() EXCLUSIVE_TRYLOCK_FUNCTION(true)
    {
        return PARENT::try_lock();
    }
    using UniqueLock = std::unique_lock<PARENT>;
#ifdef __clang__
    
    
    
    const AnnotatedMixin& operator!() const { return *this; }
#endif 
};
/**
 * Wrapped mutex: supports recursive locking, but no waiting
 * TODO: We should move away from using the recursive lock by default.
 */
using RecursiveMutex = AnnotatedMixin<std::recursive_mutex>;
using Mutex = AnnotatedMixin<std::mutex>;
/** Different type to mark Mutex at global scope
 *
 * Thread safety analysis can't handle negative assertions about mutexes
 * with global scope well, so mark them with a separate type, and
 * eventually move all the mutexes into classes so they are not globally
 * visible.
 *
 * See: https://github.com/bitcoin/bitcoin/pull/20272#issuecomment-720755781
 */
class GlobalMutex : public Mutex { };
#define AssertLockHeld(cs) AssertLockHeldInternal(#cs, __FILE__, __LINE__, &cs)
inline void AssertLockNotHeldInline(const char* name, const char* file, int line, Mutex* cs) EXCLUSIVE_LOCKS_REQUIRED(!cs) { AssertLockNotHeldInternal(name, file, line, cs); }
inline void Asser