Fix an endian issue

Under python < 3, the endian of encoded bytes was wrong. This means broken transactions if PUSHDATA2 happens to be used.