As flags (like an upgrade being active) have been added in the codepath of
checks2 (contextualChecks), we need to make sure that we update the flags
to the current block just before we do that. So move this one up.
The IDE include checker got to the point where it is actually useful and
this removes a lot of unneeded includes.
Naturally, especially for headers like util.h, this may mean we need to
re-add includes in consuming cpp files that bloats the diff a bit.
Similar to the previous commit; make sure that the ValidationContext has
access to the new Tx format so new code can use it directly.
In practically all cases (outside of the unit tests) callers already had
a Tx instance. Making it just a matter of sending it with.
Notice that the Tx object is immutable and implicitly shared which makes
it cheaper to pass around.
The MutableTransaction is only for creation,
the CTransaction is basically only there for backwards compatibility and
is kind of half deprecated.
The Tx class is to be used for all new code in validation.
The reason for this is because the CTransaction and friends are terribly
expensive to create and they have horrible effects on multi-threaded
validation.
So, to help this concept along we now pass both the old and the new tx
to a method that has not been ported to use the new yet. This at
least makes available the new Tx instance so when new code is written
it is easier to do the right thing (tm).
We add a Token class to Tx, which adds an easy to use API when compared
to the plain iterator. The main point of the API chosen is to make sure
we don't do unneeded parsing or copying for tokens unless needed.
Additionally refactor the ValidationPrivate::UnspentOutput class to
inherit from the Tx::Output class in order to avoid lots of duplicated
logic on handling the data.