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/611291c198eb2be9bf1aea1bf9b2187b18bdb3aa
---
Depends on D6420
Partial backport of Core PR15713