IsCoinBase check is already performed early by
AcceptToMemoryPoolWorker
GetDepthInMainChain check is already perfomed by
BroadcastTransaction
To avoid deadlock we MUST keep lock order in
ResendWalletTransactions and CommitTransaction,
even if we lock cs_main again further.
in BroadcastTransaction. Lock order will need
to be clean at once in a future refactoring
https://github.com/bitcoin/bitcoin/pull/15713/commits/8753f5652b4710e66b50ce87788bf6f33619b75a
Depends on D6420
Partial backport of Core PR15713