In specter https://github.com/cryptoadvance/specter-desktop/issues/1491#issuecomment-1126145011 a user can abandon an receiving tx that was evicted from the mempool (for example because it was double spent). The tx is marked via abandontransaction as abandoned in bitcoin core.
However gettransaction and listtransactions do not return the field abandoned, even though this is visible in the GUI:

Consequence: Specter cannot get the abandoned information from bitcoin rpc, and will fetch the abandoned tx back again via listtransactions after it was deleted in specter.
Describe the solution you'd like
Always return the abandoned field in https://github.com/bitcoin/bitcoin/blob/225e5b57b2ee2bc1acd7f09c89ccccc15ef8c85f/src/wallet/rpc/transactions.cpp#L345 and not only in this special case https://github.com/bitcoin/bitcoin/blob/225e5b57b2ee2bc1acd7f09c89ccccc15ef8c85f/src/wallet/rpc/transactions.cpp#L375
That should then automatically solve gettransaction via https://github.com/bitcoin/bitcoin/blob/225e5b57b2ee2bc1acd7f09c89ccccc15ef8c85f/src/wallet/rpc/transactions.cpp#L795
Describe alternatives you've considered If specter can't get the information about abandoned tx from bitcoin, it would have to keep an internal list. That is possible, but redundant and can lead to many edge cases.
Steps to reproduce
- Wallet A: Send 1 BTC to Wallet B (rbf)
- Wallet A: Replace tx with rbf to send all funds to wallet A
- Wallet B: Abandon tx (because no longer in mempool)
- Wallet B: gettransaction will not show the
abandonedfield