Compute script flags based on the chain tip rather than the block we are connecting.
Summary: This fixes T288 and ensures that flags are consistent when accepting new block and when accepting txns in the mempool without having to build extra piping.
Test Plan:
make check
Do IBD on mainnet and testnet
Reviewers: #bitcoin_abc, schancel
Reviewed By: #bitcoin_abc, schancel
Subscribers: teamcity
Maniphest Tasks: T288
Differential Revision: https://reviews.bitcoinabc.org/D1271