rippled
rippled copied to clipboard
`median_fee` in fee command is inaccurate (Version: 1.8.1)
Issue Description
The fee command returns a drops.median_fee field that is supposed to represent the median transaction cost paid in the last validated ledger. However, due to the way the underlying value is used in the fee escalation code, this field has a minimum value of 5000, "to ensure that fee escalation is meaningful even when there aren't many transactions." (To quote @ximinez)
However, the minimum having a value of 5000 is overkill for most users, who only want to know how much they should pay to give their transaction a good chance of being confirmed. (For example, in a lot of recent ledgers, the median fee was probably more in the tens or hundreds of drops, not thousands.) As best I can tell, this is a case where the API is exposing an implementation detail of the fee escalation formula. After all, the median fee in the validated ledger is an actual empirical observation of what fees are being confirmed by consensus.
The command should probably return the actual median fee from the last validated ledger, which would be actually useful for API users. (The escalation calculations can still use the value of 5000 internally.)
In the special case where the previous ledger is empty (something that happens regularly on test networks like Devnet), I think it should return the minimum fee.
Good idea. It can continue to return the 5000 minimum in a new field, e.g.fee_factor. Or would it be better to return the real median fee in new field? e.g. actual_median_fee
actual_median_fee sounds more like an elaborate joke to be honest.
If the median_fee is defined as the median fee of the last validated ledger, it should be either 0 or the median fee of the last validated ledger. If other metrics are needed to determine a useful fee to pay, these should be added and properly named and defined.