Why does the hex transaction need to be decoded?
wouldnt the whole process work just as fine as
tx_hash = double_sha256(HEX_TRANSACTION)
. Whats the reasoning for adding this extra step?
you have to go look at what "double_sha256" method is doing under the hood. that function only understands an array of bytes. it can not understand a "string" which happens to be a hexadecimal one in this case. so you first "translate" it by calling "decode"