I’ve stared at the code of https://github.com/bitcoin/bitcoin/blob/master/src/txdb.cpp#L114 for a while, and can’t seem to discover where the key (transaction id for the following outputs) is serialized to the HashWriter. I don’t think this is happening at all.
As I see it, but I could be confused, is that this is a problem as it means different transactions in the same position with the same outputs will potentially result in the same hash.
Another slight issue (but more of a naming/documentation one) is that nSerializedSize
is confusing: it’s not the size of the data hashed to hashSerialized
, but a differently computed quantity.