The rationale behind not returning fees in case of rejection was mempool policy is not the only reason why a transaction might be rejected. In case of ill-formed transactions, returning a fee might cause a problem because it might try to return something that doesn’t make sense. If I am not mistaken then it will return 0 fee for ill-formed transactions. Seeing a fee=0
along with allowed=false
can create false conclusion for the user that something is wrong with the fee, while the problem is somewhere else entirely. So this can create more confusion than help.
So such cases need to be separately handled.
On the other hand, CheckFeeRate
already throws both the package fee
and min_fee*
as an error message in case of a mempool policy rejection, and other checks throws other relevant errors. So a user seeing allowed=false
will need to investigate further anyway and all the relevant information are available in the log error messages, including the fee.
So it felt redundant to try to return fee in case of failure in the RPC call and handle all the edge cases.
If it needs to be done anyway for some other reasons, I think it’s better to do it in a separate PR. It will also need some added testings too to ensure what is returned actually makes sense.