def weight
      if witness?
        serialize_old_format.bytesize * (WITNESS_SCALE_FACTOR - 1) + serialize_witness_format.bytesize
      else
        serialize_old_format.bytesize * WITNESS_SCALE_FACTOR
      end
    end
def weight
      if witness?
        serialize_old_format.bytesize * (WITNESS_SCALE_FACTOR - 1) + serialize_witness_format.bytesize
      else
        serialize_old_format.bytesize * WITNESS_SCALE_FACTOR
      end
    end
calculate tx weight
 weight = (legacy tx payload) * 3 + (witness tx payload)