Currently OutPoint contains block_time field which is used to validate relative locktime — when the TXO can be spent only if enough time have past since the block containing that TXO.
MTP is the median of previous timestamps for the chain state preceding the target block.
We have this data, we just need to propagate it down to the place where it's needed.
Fix
Remove block_time field from outpoint and add new median_time_past field.
Compute MTP once (currently it is done in validate_timestamp, so it can be a ret value) and then use for every tx input
Update data generation scripts accordingly and regenerate tests
Problem
Currently
OutPoint
containsblock_time
field which is used to validate relative locktime — when the TXO can be spent only if enough time have past since the block containing that TXO.However in Bitcoin core they use MTP (median time past) for that purpose: https://github.com/bitcoin/bitcoin/blob/712a2b5453cdf2568fece94b969d6e0923b6ba16/src/consensus/tx_verify.cpp#L74
MTP is the median of previous timestamps for the chain state preceding the target block.
We have this data, we just need to propagate it down to the place where it's needed.
Fix
block_time
field from outpoint and add newmedian_time_past
field.