I want to get statistics on how many percentage of unconfirmed tx in the mempool are having attempted double spends and having what value. For this I want to get notification when an unconfirmed tx arrives that is conflicting with existing tx in mempool. I understand that bitcoind will accept the first transaction it sees and reject the next one, can I configure/patch bitcoind to send me notification on such double spend attempt ?
PS: I understand that a double spend can happen by directly including new tx in the next block without ever showing up in unconfirmed tx list. I think that requires direct access to mining pool and enough guarantees that the block will be mined. For my experiment, I am fine with ignoring this case as it has low probability.