Move func 'REF' from util.h to serialize.h

util.h doesn't use REF, serialize.h does, creating a dependency of
serialize.h on util.h, but util.h already depends on serialize.h.  To
resolve this circular dependency the function 'REF' has now been moved
closer to one of its two points of use.

Signed-off-by: Giel van Schijndel <me@mortis.eu>
Merge commit '82dc6426b4cbf769ace7976c2a40d160b8d76f08' into namecoin_merge_v0.8