Deduplicate code that exists in both tx processing and ProcessOrphanTx.
Additionally, this can be reused in a function that handles multiple
MempoolAcceptResults from package submission.
refactor: consolidate MempoolAcceptResult processing
Every time we try to ProcessTransaction (i.e. submit a tx to mempool), we use the result to update a few net processing data structures. For example, after a failure, the {wtxid, txid, both, neither} (depending on reason) should be cached in m_recent_rejects so we don't try to download/validate it again. There are 2 current places and at least 1 future place where we need to process MempoolAcceptResult [...] Consolidate this code so it isn't repeated in 2 places and so we can reuse it in a future PR.
Backport of core#29619.
Refactor only, there is no change in behavior.
Backport note: the TX_UNKNOWN validation state has not been backported and is skipped in the net_processing check for invalid txs. To this date this enum value is never used upstream so we're not missing anything (introduced in core#28785).